Small fixes

This commit is contained in:
Vitaliy 2021-04-12 11:31:24 +03:00
parent 52f13a7e42
commit 28df99cffb
5 changed files with 4 additions and 38 deletions

View file

@ -39,14 +39,6 @@ public abstract class SwitchableAction<T> extends QuickAction {
protected static final String KEY_DIALOG = "dialog"; 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 EditText title;
private transient Adapter adapter; private transient Adapter adapter;
@ -115,28 +107,10 @@ public abstract class SwitchableAction<T> extends QuickAction {
@Override @Override
public String getActionText(OsmandApplication application) { public String getActionText(OsmandApplication application) {
String currentSource = ""; String item = getSelectedItem(application);
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 arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6"; 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 @Override

View file

@ -30,8 +30,6 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static net.osmand.AndroidUtils.isLayoutRtl;
public class MapStyleAction extends SwitchableAction<String> { public class MapStyleAction extends SwitchableAction<String> {

View file

@ -28,8 +28,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static net.osmand.AndroidUtils.isLayoutRtl;
public class MapOverlayAction extends SwitchableAction<Pair<String, String>> { public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
private final static String KEY_OVERLAYS = "overlays"; private final static String KEY_OVERLAYS = "overlays";
@ -61,7 +59,7 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
@Override @Override
public String getSelectedItem(OsmandApplication app) { 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 @Override

View file

@ -29,8 +29,6 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static net.osmand.AndroidUtils.isLayoutRtl;
public class MapSourceAction extends SwitchableAction<Pair<String, String>> { public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
public static final String LAYER_OSM_VECTOR = "LAYER_OSM_VECTOR"; public static final String LAYER_OSM_VECTOR = "LAYER_OSM_VECTOR";

View file

@ -28,8 +28,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static net.osmand.AndroidUtils.isLayoutRtl;
public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> { public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
@ -61,7 +59,7 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
@Override @Override
public String getSelectedItem(OsmandApplication app) { 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 @Override