Quick action map: suggestion to display current map name

This commit is contained in:
androiddevkotlin 2021-04-01 10:51:00 +03:00
parent ca80f13d13
commit 169d734f47
5 changed files with 42 additions and 3 deletions

View file

@ -12,6 +12,7 @@
-->
<string name="ltr_or_rtl_combine_via_plus">%1$s + %2$d</string>
<string name="update_all_maps_added">Update all maps added to %1$s?</string>
<string name="release_4_0_beta">
• OsmAnd Live updates moved to \"Downloads > Updates\"\n\n

View file

@ -245,4 +245,13 @@ public class MapStyleAction extends SwitchableAction<String> {
? filters.get(0) + " +" + (filters.size() - 1)
: filters.get(0);
}
@Override
public String getActionText(OsmandApplication application) {
List<String> mapStyles = getFilteredStyles();
int mapCount = mapStyles.size() - 1;
String name = application.getSettings().RENDERER.get();
return application.getString(R.string.ltr_or_rtl_combine_via_plus, name, mapCount);
}
}

View file

@ -104,8 +104,8 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
}
int index = -1;
final String currentSource = settings.MAP_OVERLAY.get() == null ? KEY_NO_OVERLAY
: settings.MAP_OVERLAY.get();
String currentSource = settings.MAP_OVERLAY.get() == null ? KEY_NO_OVERLAY
: settings.MAP_OVERLAY.get();
for (int idx = 0; idx < sources.size(); idx++) {
if (sources.get(idx).first.equals(currentSource)) {
@ -224,4 +224,13 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
return super.fillParams(root, activity);
}
@Override
public String getActionText(OsmandApplication application) {
List<Pair<String, String>> sources = loadListFromParams();
int mapCount = sources.size() - 1;
String name = application.getSettings().MAP_OVERLAY.get();
return application.getString(R.string.ltr_or_rtl_combine_via_plus, name, mapCount);
}
}

View file

@ -91,7 +91,7 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
OsmandSettings settings = activity.getMyApplication().getSettings();
List<Pair<String, String>> sources = loadListFromParams();
if (sources.size() > 0) {
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
boolean showBottomSheetStyles = Boolean.parseBoolean(getParams().get(KEY_DIALOG));
if (showBottomSheetStyles) {
showChooseDialog(activity.getSupportFragmentManager());
return;
@ -214,4 +214,15 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
return super.fillParams(root, activity);
}
@Override
public String getActionText(OsmandApplication application) {
Pair<String, String> currentSource = application.getSettings().MAP_ONLINE_DATA.get()
? new Pair<>(application.getSettings().MAP_TILE_SOURCES.get(), application.getSettings().MAP_TILE_SOURCES.get())
: new Pair<>(LAYER_OSM_VECTOR, application.getString(R.string.vector_data));
final LinkedHashMap<String, String> entriesMap = new LinkedHashMap<>();
int mapCount = entriesMap.size() - 1;
return application.getString(R.string.ltr_or_rtl_combine_via_plus, currentSource, mapCount);
}
}

View file

@ -226,4 +226,13 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
return super.fillParams(root, activity);
}
@Override
public String getActionText(OsmandApplication application) {
List<Pair<String, String>> sources = loadListFromParams();
int mapCount = sources.size() - 1;
String name = application.getSettings().MAP_UNDERLAY.get();
return application.getString(R.string.ltr_or_rtl_combine_via_plus, name, mapCount);
}
}