From 3560de5e3e82df9633ff49614bc6cc5bdb16c72f Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Fri, 9 Apr 2021 14:02:27 +0300 Subject: [PATCH] Review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use this arrow LTR: "▶", RTL: "◀". Check how it work with RTL. --- OsmAnd/res/values/strings.xml | 2 +- .../quickaction/actions/MapStyleAction.java | 9 ++++++--- .../plus/rastermaps/MapOverlayAction.java | 7 +++++-- .../osmand/plus/rastermaps/MapSourceAction.java | 17 ++++++++++------- .../plus/rastermaps/MapUnderlayAction.java | 9 ++++++--- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 97cfcf3a42..5bac9b0326 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,7 +12,7 @@ --> - %1$s → … + %1$s %2$s … Output User points Announce when exceeded diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java index 5838bfc1a2..c487cd494c 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java @@ -30,6 +30,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import static net.osmand.AndroidUtils.isLayoutRtl; + public class MapStyleAction extends SwitchableAction { @@ -54,7 +56,7 @@ public class MapStyleAction extends SwitchableAction { if (current != null) { return current.getName(); } else { - return RendererRegistry.DEFAULT_RENDER; + return RendererRegistry.DEFAULT_RENDER; } } @@ -77,7 +79,7 @@ public class MapStyleAction extends SwitchableAction { executeWithParams(activity, nextStyle); } else { Toast.makeText(activity, R.string.quick_action_need_to_add_item_to_list, - Toast.LENGTH_LONG).show(); + Toast.LENGTH_LONG).show(); } } @@ -249,7 +251,8 @@ public class MapStyleAction extends SwitchableAction { @Override public String getActionText(OsmandApplication application) { String currentSource = application.getSettings().RENDERER.get(); + String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6"; - return application.getString(R.string.map_quick_action_pattern, getTranslatedItemName(application, currentSource)); + return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection); } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java index 8190b6c995..cc01b93e24 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java @@ -15,19 +15,21 @@ import com.google.gson.reflect.TypeToken; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.quickaction.SwitchableAction; +import net.osmand.plus.settings.backend.OsmandSettings; import java.lang.reflect.Type; 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"; @@ -229,7 +231,8 @@ public class MapOverlayAction extends SwitchableAction> { public String getActionText(OsmandApplication application) { String currentSource = application.getSettings().MAP_OVERLAY.get() == null ? KEY_NO_OVERLAY : application.getSettings().MAP_OVERLAY.get(); + String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6"; - return application.getString(R.string.map_quick_action_pattern, getTranslatedItemName(application, currentSource)); + return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection); } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java index d81b1f12ed..187e6e262a 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java @@ -15,13 +15,13 @@ import com.google.gson.reflect.TypeToken; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.quickaction.SwitchableAction; +import net.osmand.plus.settings.backend.OsmandSettings; import java.lang.reflect.Type; import java.util.ArrayList; @@ -29,6 +29,8 @@ 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"; @@ -98,8 +100,8 @@ public class MapSourceAction extends SwitchableAction> { } Pair currentSource = settings.MAP_ONLINE_DATA.get() - ? new Pair<>(settings.MAP_TILE_SOURCES.get(), settings.MAP_TILE_SOURCES.get()) - : new Pair<>(LAYER_OSM_VECTOR, activity.getString(R.string.vector_data)); + ? new Pair<>(settings.MAP_TILE_SOURCES.get(), settings.MAP_TILE_SOURCES.get()) + : new Pair<>(LAYER_OSM_VECTOR, activity.getString(R.string.vector_data)); Pair nextSource = sources.get(0); int index = sources.indexOf(currentSource); @@ -135,7 +137,7 @@ public class MapSourceAction extends SwitchableAction> { return item; } } - + @Override protected int getAddBtnText() { return R.string.quick_action_map_source_action; @@ -218,9 +220,10 @@ public class MapSourceAction extends SwitchableAction> { @Override public String getActionText(OsmandApplication application) { String currentSource = application.getSettings().MAP_ONLINE_DATA.get() - ? application.getSettings().MAP_TILE_SOURCES.get() - : application.getString(R.string.vector_data); + ? application.getSettings().MAP_TILE_SOURCES.get() + : application.getString(R.string.vector_data); + String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6"; - return application.getString(R.string.map_quick_action_pattern, getTranslatedItemName(application, currentSource)); + return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection); } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java index ddb941e10b..fa7aae54c0 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java @@ -28,6 +28,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static net.osmand.AndroidUtils.isLayoutRtl; + public class MapUnderlayAction extends SwitchableAction> { @@ -103,7 +105,7 @@ public class MapUnderlayAction extends SwitchableAction> { int index = -1; final String currentSource = settings.MAP_UNDERLAY.get() == null ? KEY_NO_UNDERLAY - : settings.MAP_UNDERLAY.get(); + : settings.MAP_UNDERLAY.get(); for (int idx = 0; idx < sources.size(); idx++) { if (sources.get(idx).first.equals(currentSource)) { @@ -157,7 +159,7 @@ public class MapUnderlayAction extends SwitchableAction> { return item; } } - + @Override protected int getAddBtnText() { return R.string.quick_action_map_underlay_action; @@ -231,7 +233,8 @@ public class MapUnderlayAction extends SwitchableAction> { public String getActionText(OsmandApplication application) { String currentSource = application.getSettings().MAP_UNDERLAY.get() == null ? KEY_NO_UNDERLAY : application.getSettings().MAP_UNDERLAY.get(); + String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6"; - return application.getString(R.string.map_quick_action_pattern, getTranslatedItemName(application, currentSource)); + return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection); } }