diff --git a/OsmAnd/res/values-ar/strings.xml b/OsmAnd/res/values-ar/strings.xml index 4cb0bab704..307f2513cc 100644 --- a/OsmAnd/res/values-ar/strings.xml +++ b/OsmAnd/res/values-ar/strings.xml @@ -4154,5 +4154,4 @@ الإعلان عند التجاوز نقاط المستخدم الإخراج - %1$s ← … \ No newline at end of file diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 094ba47620..dae511a7f4 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -4089,5 +4089,4 @@ Meldung bei Überschreitung Anwenderpunkte Leistung - %1$s → … \ No newline at end of file diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index 5b9d9345b5..19328a93e7 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -4085,5 +4085,4 @@ Numero de elirejo Poentoj de uzanto Eligo - %1$s → … \ No newline at end of file diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index bcf6918377..c7a7007a59 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -4087,5 +4087,4 @@ Anunciar al excederse Puntos de usuario Salida - %1$s → … \ No newline at end of file diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index b45c597a1a..8fa7588019 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4075,5 +4075,4 @@ Numéro de sortie Annoncer en cas de dépassement Sortie - %1$s → … \ No newline at end of file diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 9709e8bce8..ced108288e 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -4074,7 +4074,6 @@ Várakoztatva Lejárt Frissüljön minden térkép, amely hozzá lett adva ehhez: %1$s\? - %1$s → … Kijárat száma Értesítés túllépéskor Felhasználói pontok diff --git a/OsmAnd/res/values-iw/strings.xml b/OsmAnd/res/values-iw/strings.xml index e7684a1670..8fee045082 100644 --- a/OsmAnd/res/values-iw/strings.xml +++ b/OsmAnd/res/values-iw/strings.xml @@ -4087,5 +4087,4 @@ להכריז בחריגה נקודות משתמש פלט - %1$s ← … \ No newline at end of file diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml index d805e31c37..8d3a99bb75 100644 --- a/OsmAnd/res/values-pt/strings.xml +++ b/OsmAnd/res/values-pt/strings.xml @@ -4089,5 +4089,4 @@ Anunciar quando ultrapassado Pontos do utilizador Saída - %1$s → … \ No newline at end of file diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 3ad683a6fb..4fe37da2e3 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -4084,5 +4084,4 @@ Повідомляти про перевищення Користувацькі точки Вивід - %1$s → … \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 97cfcf3a42..9959488bd2 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,7 +12,6 @@ --> - %1$s → … Output User points Announce when exceeded diff --git a/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java b/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java index f1bc2c927a..412eba2323 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/SwitchableAction.java @@ -13,7 +13,6 @@ import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.ColorInt; -import androidx.annotation.ColorRes; import androidx.annotation.DrawableRes; import androidx.annotation.StringRes; import androidx.appcompat.widget.SwitchCompat; @@ -32,10 +31,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import static net.osmand.AndroidUtils.isLayoutRtl; + public abstract class SwitchableAction extends QuickAction { public static final String KEY_ID = "id"; - + protected static final String KEY_DIALOG = "dialog"; private transient EditText title; @@ -62,7 +63,7 @@ public abstract class SwitchableAction extends QuickAction { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.quick_action_switchable_action, parent, false); - final SwitchCompat showDialog = (SwitchCompat) view.findViewById(R.id.saveButton); + final SwitchCompat showDialog = view.findViewById(R.id.saveButton); if (!getParams().isEmpty()) { showDialog.setChecked(Boolean.valueOf(getParams().get(KEY_DIALOG))); } @@ -74,7 +75,7 @@ public abstract class SwitchableAction extends QuickAction { } }); - RecyclerView list = (RecyclerView) view.findViewById(R.id.list); + RecyclerView list = view.findViewById(R.id.list); adapter = new Adapter(activity, new QuickActionListFragment.OnStartDragListener() { @Override public void onStartDrag(RecyclerView.ViewHolder viewHolder) { @@ -92,9 +93,9 @@ public abstract class SwitchableAction extends QuickAction { list.setAdapter(adapter); - TextView dscrTitle = (TextView) view.findViewById(R.id.textDscrTitle); - TextView dscrHint = (TextView) view.findViewById(R.id.textDscrHint); - Button addBtn = (Button) view.findViewById(R.id.btnAdd); + TextView dscrTitle = view.findViewById(R.id.textDscrTitle); + TextView dscrHint = view.findViewById(R.id.textDscrHint); + Button addBtn = view.findViewById(R.id.btnAdd); dscrTitle.setText(parent.getContext().getString(getDiscrTitle()) + ":"); dscrHint.setText(getDiscrHint()); @@ -104,10 +105,18 @@ public abstract class SwitchableAction extends QuickAction { parent.addView(view); } + @Override + public String getActionText(OsmandApplication application) { + String item = getSelectedItem(application); + String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6"; + + return application.getString(R.string.ltr_or_rtl_combine_via_space, getTranslatedItemName(application, item), arrowDirection + "\u2026"); + } + @Override public boolean fillParams(View root, MapActivity activity) { - final RecyclerView list = (RecyclerView) root.findViewById(R.id.list); + final RecyclerView list = root.findViewById(R.id.list); final Adapter adapter = (Adapter) list.getAdapter(); boolean hasParams = adapter.itemsList != null && !adapter.itemsList.isEmpty(); @@ -124,7 +133,7 @@ public abstract class SwitchableAction extends QuickAction { public abstract List loadListFromParams(); public abstract void executeWithParams(MapActivity activity, String params); - + public abstract String getTranslatedItemName(Context context, String item); protected void showChooseDialog(FragmentManager fm) { @@ -143,7 +152,7 @@ public abstract class SwitchableAction extends QuickAction { private List itemsList = new ArrayList<>(); private final QuickActionListFragment.OnStartDragListener onStartDragListener; - private Context context; + private final Context context; public Adapter(Context context, QuickActionListFragment.OnStartDragListener onStartDragListener) { this.context = context; @@ -293,10 +302,10 @@ public abstract class SwitchableAction extends QuickAction { public ItemHolder(View itemView) { super(itemView); - title = (TextView) itemView.findViewById(R.id.title); - handleView = (ImageView) itemView.findViewById(R.id.handle_view); - closeBtn = (ImageView) itemView.findViewById(R.id.closeImageButton); - icon = (ImageView) itemView.findViewById(R.id.imageView); + title = itemView.findViewById(R.id.title); + handleView = itemView.findViewById(R.id.handle_view); + closeBtn = itemView.findViewById(R.id.closeImageButton); + icon = itemView.findViewById(R.id.imageView); } } } diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java index 5838bfc1a2..eedfe1beb7 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java @@ -54,7 +54,7 @@ public class MapStyleAction extends SwitchableAction { if (current != null) { return current.getName(); } else { - return RendererRegistry.DEFAULT_RENDER; + return RendererRegistry.DEFAULT_RENDER; } } @@ -77,7 +77,7 @@ public class MapStyleAction extends SwitchableAction { 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(); } } @@ -246,10 +246,4 @@ public class MapStyleAction extends SwitchableAction { : 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)); - } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java index da31b61466..24bff5e458 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/SwitchProfileAction.java @@ -27,6 +27,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import static net.osmand.AndroidUtils.isLayoutRtl; + public class SwitchProfileAction extends SwitchableAction { private final static String KEY_PROFILES = "profiles"; @@ -230,4 +232,11 @@ public class SwitchProfileAction extends SwitchableAction { } } } + + @Override + public String getActionText(OsmandApplication application) { + String item = getSelectedItem(application); + + return application.getString(R.string.ltr_or_rtl_combine_via_space, getTranslatedItemName(application, item), "\u2026"); + } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java index 8190b6c995..2dc809488e 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java @@ -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; @@ -59,7 +59,7 @@ public class MapOverlayAction extends SwitchableAction> { @Override 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 @@ -224,12 +224,4 @@ 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) { - 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)); - } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java index d81b1f12ed..8ace30844b 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java @@ -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; @@ -98,8 +98,8 @@ public class MapSourceAction extends SwitchableAction> { } Pair 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 nextSource = sources.get(0); int index = sources.indexOf(currentSource); @@ -135,7 +135,7 @@ public class MapSourceAction extends SwitchableAction> { return item; } } - + @Override protected int getAddBtnText() { return R.string.quick_action_map_source_action; @@ -214,13 +214,4 @@ 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) { - 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)); - } } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java index ddb941e10b..167338add1 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java @@ -59,7 +59,7 @@ public class MapUnderlayAction extends SwitchableAction> { @Override 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 @@ -103,7 +103,7 @@ public class MapUnderlayAction extends SwitchableAction> { 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)) { @@ -157,7 +157,7 @@ public class MapUnderlayAction extends SwitchableAction> { return item; } } - + @Override protected int getAddBtnText() { return R.string.quick_action_map_underlay_action; @@ -226,12 +226,4 @@ 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) { - 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)); - } }