diff --git a/OsmAnd/res/layout/quick_action_show_hide_favorites.xml b/OsmAnd/res/layout/quick_action_show_hide_favorites.xml
new file mode 100644
index 0000000000..b2f8b51129
--- /dev/null
+++ b/OsmAnd/res/layout/quick_action_show_hide_favorites.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 9df977609f..bbb2137877 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -2487,4 +2487,6 @@ If you need help with OsmAnd application, please contact our support team: suppo
Place
Specified quick action name already in use, was changed to %1$s to avoid duplication.
Quick action name duplicate
+ Tap on action will Show or Hide favorites points on map.
+ Show/Hide Favorites
diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
index b92b0fff22..49f59e115f 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
@@ -70,6 +70,7 @@ public class QuickActionFactory {
quickActions.add(new MarkerAction());
quickActions.add(new FavoriteAction());
+ quickActions.add(new ShowHideFavoritesAction());
return quickActions;
}
@@ -87,6 +88,9 @@ public class QuickActionFactory {
case FavoriteAction.TYPE:
return new FavoriteAction();
+ case ShowHideFavoritesAction.TYPE:
+ return new ShowHideFavoritesAction();
+
default:
return new QuickAction();
}
@@ -105,6 +109,9 @@ public class QuickActionFactory {
case FavoriteAction.TYPE:
return new FavoriteAction(quickAction);
+ case ShowHideFavoritesAction.TYPE:
+ return new ShowHideFavoritesAction(quickAction);
+
default:
return quickAction;
}
@@ -177,13 +184,10 @@ public class QuickActionFactory {
@Override
public void drawUI(ViewGroup parent, MapActivity activity) {
- if (parent.getChildCount() == 0) {
+ View view = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.quick_action_add_marker, parent, false);
- View view = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.quick_action_add_marker, parent, false);
-
- parent.addView(view);
- }
+ parent.addView(view);
}
}
@@ -374,4 +378,36 @@ public class QuickActionFactory {
}
}
}
+
+ public static class ShowHideFavoritesAction extends QuickAction {
+
+ public static final int TYPE = 4;
+
+ protected ShowHideFavoritesAction() {
+ id = System.currentTimeMillis();
+ type = TYPE;
+ nameRes = R.string.quic_action_showhide_favorites_title;
+ iconRes = R.drawable.ic_action_fav_dark;
+ }
+
+ public ShowHideFavoritesAction(QuickAction quickAction) {
+ super(quickAction);
+ }
+
+ @Override
+ public void execute(MapActivity activity) {
+
+ activity.getMyApplication().getSettings().SHOW_FAVORITES.set(
+ !activity.getMyApplication().getSettings().SHOW_FAVORITES.get());
+ }
+
+ @Override
+ public void drawUI(ViewGroup parent, MapActivity activity) {
+
+ View view = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.quick_action_show_hide_favorites, parent, false);
+
+ parent.addView(view);
+ }
+ }
}