From 169d734f47e792c7749d8bd63e84f30697e6c9ba Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Thu, 1 Apr 2021 10:51:00 +0300 Subject: [PATCH] Quick action map: suggestion to display current map name --- OsmAnd/res/values/strings.xml | 1 + .../plus/quickaction/actions/MapStyleAction.java | 9 +++++++++ .../osmand/plus/rastermaps/MapOverlayAction.java | 13 +++++++++++-- .../net/osmand/plus/rastermaps/MapSourceAction.java | 13 ++++++++++++- .../osmand/plus/rastermaps/MapUnderlayAction.java | 9 +++++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a716c8b4f7..5cb21e97eb 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,6 +12,7 @@ --> + %1$s + %2$d Update all maps added to %1$s? • OsmAnd Live updates moved to \"Downloads > Updates\"\n\n diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java index 1bcac88a36..1e2a8e097e 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java @@ -245,4 +245,13 @@ public class MapStyleAction extends SwitchableAction { ? filters.get(0) + " +" + (filters.size() - 1) : filters.get(0); } + + @Override + public String getActionText(OsmandApplication application) { + List 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); + } } \ 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 7972b264aa..15ae55cfae 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java @@ -104,8 +104,8 @@ public class MapOverlayAction extends SwitchableAction> { } 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> { 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> 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); + } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java index b11a8ec812..556f8bbd61 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java @@ -91,7 +91,7 @@ public class MapSourceAction extends SwitchableAction> { OsmandSettings settings = activity.getMyApplication().getSettings(); List> 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> { 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 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 entriesMap = new LinkedHashMap<>(); + int mapCount = entriesMap.size() - 1; + + return application.getString(R.string.ltr_or_rtl_combine_via_plus, currentSource, mapCount); + } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java index ed598a344b..0bb2838b36 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java @@ -226,4 +226,13 @@ public class MapUnderlayAction extends SwitchableAction> { 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> 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); + } }