diff --git a/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java b/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java index f912e9260f..412eba2323 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java @@ -39,14 +39,6 @@ public abstract class SwitchableAction extends QuickAction { protected static final String KEY_DIALOG = "dialog"; - private final static String MAP_STYLE_ACTION = "mapstyle.change"; - private final static String MAP_SOURCE_ACTION = "mapsource.change"; - private final static String MAP_OVERLAY_ACTION = "mapoverlay.change"; - private final static String MAP_UNDERLAY_ACTION = "mapunderlay.change"; - - private final static String KEY_NO_OVERLAY = "no_overlay"; - private final static String KEY_NO_UNDERLAY = "no_underlay"; - private transient EditText title; private transient Adapter adapter; @@ -115,28 +107,10 @@ public abstract class SwitchableAction extends QuickAction { @Override public String getActionText(OsmandApplication application) { - String currentSource = ""; - switch (getActionType().getStringId()) { - case MAP_STYLE_ACTION: - currentSource = application.getSettings().RENDERER.get(); - break; - case MAP_SOURCE_ACTION: - currentSource = application.getSettings().MAP_ONLINE_DATA.get() - ? application.getSettings().MAP_TILE_SOURCES.get() - : application.getString(R.string.vector_data); - break; - case MAP_OVERLAY_ACTION: - currentSource = application.getSettings().MAP_OVERLAY.get() == null ? KEY_NO_OVERLAY - : application.getSettings().MAP_OVERLAY.get(); - break; - case MAP_UNDERLAY_ACTION: - currentSource = application.getSettings().MAP_UNDERLAY.get() == null ? KEY_NO_UNDERLAY - : application.getSettings().MAP_UNDERLAY.get(); - break; - } + String item = getSelectedItem(application); String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6"; - return application.getString(R.string.ltr_or_rtl_combine_via_space, getTranslatedItemName(application, currentSource), arrowDirection + "\u2026"); + return application.getString(R.string.ltr_or_rtl_combine_via_space, getTranslatedItemName(application, item), arrowDirection + "\u2026"); } @Override diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java index 3e2d297566..eedfe1beb7 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java @@ -30,8 +30,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import static net.osmand.AndroidUtils.isLayoutRtl; - public class MapStyleAction extends SwitchableAction { diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java index da31b61466..24bff5e458 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java @@ -27,6 +27,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import static net.osmand.AndroidUtils.isLayoutRtl; + public class SwitchProfileAction extends SwitchableAction { private final static String KEY_PROFILES = "profiles"; @@ -230,4 +232,11 @@ public class SwitchProfileAction extends SwitchableAction { } } } + + @Override + public String getActionText(OsmandApplication application) { + String item = getSelectedItem(application); + + return application.getString(R.string.ltr_or_rtl_combine_via_space, getTranslatedItemName(application, item), "\u2026"); + } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java index ac341d9b50..2dc809488e 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java @@ -28,8 +28,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import static net.osmand.AndroidUtils.isLayoutRtl; - public class MapOverlayAction extends SwitchableAction> { private final static String KEY_OVERLAYS = "overlays"; @@ -61,7 +59,7 @@ public class MapOverlayAction extends SwitchableAction> { @Override public String getSelectedItem(OsmandApplication app) { - return app.getSettings().MAP_OVERLAY.get(); + return app.getSettings().MAP_OVERLAY.get() != null ? app.getSettings().MAP_OVERLAY.get() : KEY_NO_OVERLAY; } @Override diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java index 92c08f8745..8ace30844b 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java @@ -29,8 +29,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import static net.osmand.AndroidUtils.isLayoutRtl; - public class MapSourceAction extends SwitchableAction> { public static final String LAYER_OSM_VECTOR = "LAYER_OSM_VECTOR"; diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java index 704afc47a2..167338add1 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java @@ -28,8 +28,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import static net.osmand.AndroidUtils.isLayoutRtl; - public class MapUnderlayAction extends SwitchableAction> { @@ -61,7 +59,7 @@ public class MapUnderlayAction extends SwitchableAction> { @Override public String getSelectedItem(OsmandApplication app) { - return app.getSettings().MAP_UNDERLAY.get(); + return app.getSettings().MAP_UNDERLAY.get() != null ? app.getSettings().MAP_UNDERLAY.get() : KEY_NO_UNDERLAY; } @Override