Use this arrow LTR: "▶", RTL: "◀".
Check how it work with RTL.
This commit is contained in:
androiddevkotlin 2021-04-09 14:02:27 +03:00
parent 1b1132148f
commit 3560de5e3e
5 changed files with 28 additions and 16 deletions

View file

@ -12,7 +12,7 @@
-->
<string name="map_quick_action_pattern">%1$s →</string>
<string name="map_quick_action_arrow_direction_pattern">%1$s %2$s</string>
<string name="output">Output</string>
<string name="user_points">User points</string>
<string name="announce_when_exceeded">Announce when exceeded</string>

View file

@ -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<String> {
@ -54,7 +56,7 @@ public class MapStyleAction extends SwitchableAction<String> {
if (current != null) {
return current.getName();
} else {
return RendererRegistry.DEFAULT_RENDER;
return RendererRegistry.DEFAULT_RENDER;
}
}
@ -77,7 +79,7 @@ public class MapStyleAction extends SwitchableAction<String> {
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<String> {
@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);
}
}

View file

@ -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<Pair<String, String>> {
private final static String KEY_OVERLAYS = "overlays";
@ -229,7 +231,8 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
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);
}
}

View file

@ -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<Pair<String, String>> {
public static final String LAYER_OSM_VECTOR = "LAYER_OSM_VECTOR";
@ -98,8 +100,8 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
}
Pair<String, String> 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<String, String> nextSource = sources.get(0);
int index = sources.indexOf(currentSource);
@ -218,9 +220,10 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
@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);
}
}

View file

@ -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<Pair<String, String>> {
@ -103,7 +105,7 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
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)) {
@ -231,7 +233,8 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
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);
}
}