diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 13d1f5dab4..1f7cd2222e 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -2546,4 +2546,6 @@ If you need help with OsmAnd application, please contact our support team: suppo
Add Source
Map source has been changed to the \"%s\".
Add
+ Change button position
+ Long tap and drag button on the screen to change position
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index c4d47659c8..a2cecff7bf 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -2458,6 +2458,8 @@ public class OsmandSettings {
public final CommonPreference QUICK_ACTION_LIST = new StringPreference("quick_action_list", "").makeGlobal();
+ public final CommonPreference IS_QUICK_ACTION_TUTORIAL_SHOWN = new BooleanPreference("quick_action_tutorial", false).makeGlobal();
+
public boolean setPortraitFabMargin(int x, int y) {
return settingsAPI.edit(globalPreferences).putInt(QUICK_FAB_MARGIN_X_PORTRAIT_MARGIN, x)
.putInt(QUICK_FAB_MARGIN_Y_PORTRAIT_MARGIN, y).commit();
diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
index c66cac1dd9..0fc34d033b 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
@@ -53,7 +53,6 @@ import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.GeocodingLookupService;
-import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
diff --git a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java
index 9475d717f5..14b8bb016a 100644
--- a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java
@@ -13,6 +13,9 @@ import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
+import com.getkeepsafe.taptargetview.TapTarget;
+import com.getkeepsafe.taptargetview.TapTargetView;
+
import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.OsmandApplication;
@@ -73,8 +76,8 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
quickActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- setLayerState(quickActionsWidget.getVisibility() == View.VISIBLE);
-
+ if (!showTutorialIfNeeded())
+ setLayerState(quickActionsWidget.getVisibility() == View.VISIBLE);
}
});
@@ -101,7 +104,6 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
}
});
-
}
public void refreshLayer() {
@@ -110,6 +112,38 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
setUpQuickActionBtnVisibility();
}
+ private boolean showTutorialIfNeeded() {
+ if (isLayerOn && !settings.IS_QUICK_ACTION_TUTORIAL_SHOWN.get()) {
+ TapTargetView.showFor(mapActivity, // `this` is an Activity
+ TapTarget.forView(quickActionButton, mapActivity.getString(R.string.quck_action_btn_tutorial_title), mapActivity.getString(R.string.quick_action_btn_tutorial_description))
+ // All options below are optional
+ .outerCircleColor(R.color.osmand_orange) // Specify a color for the outer circle
+ .targetCircleColor(R.color.color_white) // Specify a color for the target circle
+ .titleTextSize(20) // Specify the size (in sp) of the title text
+ .descriptionTextSize(16) // Specify the size (in sp) of the description text
+// .textColor(R.color.color_white) // Specify a color for both the title and description text
+ .descriptionTextColor(R.color.color_white) // Specify a color for both the title and description text
+ .titleTextColor(R.color.color_white) // Specify a color for both the title and description text
+// .textTypeface(Typeface.SANS_SERIF) // Specify a typeface for the text
+// .dimColor(R.color.black) // If set, will dim behind the view with 30% opacity of the given color
+ .drawShadow(true) // Whether to draw a drop shadow or not
+ .cancelable(false) // Whether tapping outside the outer circle dismisses the view
+ .tintTarget(false) // Whether to tint the target view's color
+ .transparentTarget(false) // Specify whether the target is transparent (displays the content underneath)
+// .icon(Drawable) // Specify a custom drawable to draw as the target
+ .targetRadius(50), // Specify the target radius (in dp)
+ new TapTargetView.Listener() { // The listener can listen for regular clicks, long clicks or cancels
+ @Override
+ public void onTargetClick(TapTargetView view) {
+ super.onTargetClick(view); // This call is optional
+ settings.IS_QUICK_ACTION_TUTORIAL_SHOWN.set(true);
+ }
+ });
+ return true;
+ } else
+ return false;
+ }
+
private void setQuickActionButtonMargin() {
FrameLayout.LayoutParams param = (FrameLayout.LayoutParams) quickActionButton.getLayoutParams();
if (AndroidUiHelper.isOrientationPortrait(mapActivity)) {
@@ -167,9 +201,9 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
private void enterMovingMode(RotatedTileBox tileBox) {
previousMapPosition = view.getMapPosition();
- view.setMapPosition( OsmandSettings.BOTTOM_CONSTANT);
+ view.setMapPosition(OsmandSettings.BOTTOM_CONSTANT);
MapContextMenu menu = mapActivity.getContextMenu();
- LatLon ll = menu.isActive() && tileBox.containsLatLon(menu.getLatLon()) ? menu.getLatLon() : tileBox.getCenterLatLon();
+ LatLon ll = menu.isActive() && tileBox.containsLatLon(menu.getLatLon()) ? menu.getLatLon() : tileBox.getCenterLatLon();
menu.updateMapCenter(null);
menu.close();
@@ -220,15 +254,15 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
@Override
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
- if (isInChangeMarkerPositionMode() && !pressedQuickActionWidget(point.x, point.y)){
+ if (isInChangeMarkerPositionMode() && !pressedQuickActionWidget(point.x, point.y)) {
setLayerState(true);
return true;
} else
return false;
}
- private boolean pressedQuickActionWidget(float px , float py) {
- return py <= quickActionsWidget.getHeight();
+ private boolean pressedQuickActionWidget(float px, float py) {
+ return py <= quickActionsWidget.getHeight();
}
@Override