From 1ce74b23eab4627852ad7cf91344a5b8ed729c0c Mon Sep 17 00:00:00 2001
From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com>
Date: Sun, 11 Apr 2021 20:47:07 +0300
Subject: [PATCH] Remove unused strings, use Unicode character instead three
dots, move method getActionText() to parent class
---
OsmAnd/res/values-ar/strings.xml | 1 -
OsmAnd/res/values-de/strings.xml | 1 -
OsmAnd/res/values-eo/strings.xml | 1 -
OsmAnd/res/values-es-rAR/strings.xml | 1 -
OsmAnd/res/values-fr/strings.xml | 1 -
OsmAnd/res/values-hu/strings.xml | 1 -
OsmAnd/res/values-iw/strings.xml | 1 -
OsmAnd/res/values-pt/strings.xml | 1 -
OsmAnd/res/values-uk/strings.xml | 1 -
OsmAnd/res/values/strings.xml | 1 -
.../plus/quickaction/SwitchableAction.java | 63 ++++++++++++++-----
.../quickaction/actions/MapStyleAction.java | 7 ---
.../plus/rastermaps/MapOverlayAction.java | 9 ---
.../plus/rastermaps/MapSourceAction.java | 10 ---
.../plus/rastermaps/MapUnderlayAction.java | 9 ---
15 files changed, 49 insertions(+), 59 deletions(-)
diff --git a/OsmAnd/res/values-ar/strings.xml b/OsmAnd/res/values-ar/strings.xml
index 3b5b131c57..073b26b6a2 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 54026c0c08..5df11bbf9d 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 e1558ef4be..9dd4028264 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 ecfadc84d3..051d717f3c 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 5bac9b0326..9959488bd2 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -12,7 +12,6 @@
-->
- %1$s %2$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..f912e9260f 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,12 +31,22 @@ 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 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 Adapter adapter;
@@ -62,7 +71,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 +83,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 +101,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 +113,36 @@ public abstract class SwitchableAction extends QuickAction {
parent.addView(view);
}
+ @Override
+ public String getActionText(OsmandApplication application) {
+ String currentSource = "";
+ 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";
+
+ return application.getString(R.string.ltr_or_rtl_combine_via_space, getTranslatedItemName(application, currentSource), 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 +159,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 +178,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 +328,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 c487cd494c..3e2d297566 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/MapStyleAction.java
@@ -248,11 +248,4 @@ public class MapStyleAction extends SwitchableAction {
: filters.get(0);
}
- @Override
- public String getActionText(OsmandApplication application) {
- String currentSource = application.getSettings().RENDERER.get();
- String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6";
-
- return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection);
- }
}
\ 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 cc01b93e24..ac341d9b50 100644
--- a/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java
+++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapOverlayAction.java
@@ -226,13 +226,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();
- String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6";
-
- return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection);
- }
}
diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java
index 187e6e262a..92c08f8745 100644
--- a/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java
+++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapSourceAction.java
@@ -216,14 +216,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);
- String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6";
-
- return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection);
- }
}
diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java
index fa7aae54c0..704afc47a2 100644
--- a/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java
+++ b/OsmAnd/src/net/osmand/plus/rastermaps/MapUnderlayAction.java
@@ -228,13 +228,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();
- String arrowDirection = isLayoutRtl(application) ? "\u25c0" : "\u25b6";
-
- return application.getString(R.string.map_quick_action_arrow_direction_pattern, getTranslatedItemName(application, currentSource), arrowDirection);
- }
}