Merge pull request #11310 from osmandapp/current-map-name

Quick action map: suggestion to display current map name
This commit is contained in:
Vitaliy 2021-04-05 09:36:17 +03:00 committed by GitHub
commit f2645a064f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 3 deletions

View file

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

View file

@ -245,4 +245,11 @@ public class MapStyleAction extends SwitchableAction<String> {
? filters.get(0) + " +" + (filters.size() - 1) ? filters.get(0) + " +" + (filters.size() - 1)
: filters.get(0); : filters.get(0);
} }
@Override
public String getActionText(OsmandApplication application) {
String currentSource = application.getSettings().RENDERER.get();
return application.getString(R.string.map_quick_action_pattern, getTranslatedItemName(application, currentSource));
}
} }

View file

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

View file

@ -91,7 +91,7 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
OsmandSettings settings = activity.getMyApplication().getSettings(); OsmandSettings settings = activity.getMyApplication().getSettings();
List<Pair<String, String>> sources = loadListFromParams(); List<Pair<String, String>> sources = loadListFromParams();
if (sources.size() > 0) { if (sources.size() > 0) {
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG)); boolean showBottomSheetStyles = Boolean.parseBoolean(getParams().get(KEY_DIALOG));
if (showBottomSheetStyles) { if (showBottomSheetStyles) {
showChooseDialog(activity.getSupportFragmentManager()); showChooseDialog(activity.getSupportFragmentManager());
return; return;
@ -214,4 +214,13 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked())); getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
return super.fillParams(root, activity); return super.fillParams(root, activity);
} }
@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);
return application.getString(R.string.map_quick_action_pattern, getTranslatedItemName(application, currentSource));
}
} }

View file

@ -226,4 +226,12 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked())); getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
return super.fillParams(root, activity); return super.fillParams(root, activity);
} }
@Override
public String getActionText(OsmandApplication application) {
String currentSource = application.getSettings().MAP_UNDERLAY.get() == null ? KEY_NO_UNDERLAY
: application.getSettings().MAP_UNDERLAY.get();
return application.getString(R.string.map_quick_action_pattern, getTranslatedItemName(application, currentSource));
}
} }