Merge pull request #11377 from osmandapp/Arrow-direction-pattern
Review
This commit is contained in:
commit
08c40319f6
16 changed files with 43 additions and 66 deletions
|
@ -4154,5 +4154,4 @@
|
|||
<string name="announce_when_exceeded">الإعلان عند التجاوز</string>
|
||||
<string name="user_points">نقاط المستخدم</string>
|
||||
<string name="output">الإخراج</string>
|
||||
<string name="map_quick_action_pattern">%1$s ← …</string>
|
||||
</resources>
|
|
@ -4089,5 +4089,4 @@
|
|||
<string name="announce_when_exceeded">Meldung bei Überschreitung</string>
|
||||
<string name="user_points">Anwenderpunkte</string>
|
||||
<string name="output">Leistung</string>
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
</resources>
|
|
@ -4085,5 +4085,4 @@
|
|||
<string name="exit_number">Numero de elirejo</string>
|
||||
<string name="user_points">Poentoj de uzanto</string>
|
||||
<string name="output">Eligo</string>
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
</resources>
|
|
@ -4087,5 +4087,4 @@
|
|||
<string name="announce_when_exceeded">Anunciar al excederse</string>
|
||||
<string name="user_points">Puntos de usuario</string>
|
||||
<string name="output">Salida</string>
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
</resources>
|
|
@ -4075,5 +4075,4 @@
|
|||
<string name="exit_number">Numéro de sortie</string>
|
||||
<string name="announce_when_exceeded">Annoncer en cas de dépassement</string>
|
||||
<string name="output">Sortie</string>
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
</resources>
|
|
@ -4074,7 +4074,6 @@
|
|||
<string name="on_hold">Várakoztatva</string>
|
||||
<string name="expired">Lejárt</string>
|
||||
<string name="update_all_maps_added">Frissüljön minden térkép, amely hozzá lett adva ehhez: %1$s\?</string>
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
<string name="exit_number">Kijárat száma</string>
|
||||
<string name="announce_when_exceeded">Értesítés túllépéskor</string>
|
||||
<string name="user_points">Felhasználói pontok</string>
|
||||
|
|
|
@ -4087,5 +4087,4 @@
|
|||
<string name="announce_when_exceeded">להכריז בחריגה</string>
|
||||
<string name="user_points">נקודות משתמש</string>
|
||||
<string name="output">פלט</string>
|
||||
<string name="map_quick_action_pattern">%1$s ← …</string>
|
||||
</resources>
|
|
@ -4089,5 +4089,4 @@
|
|||
<string name="announce_when_exceeded">Anunciar quando ultrapassado</string>
|
||||
<string name="user_points">Pontos do utilizador</string>
|
||||
<string name="output">Saída</string>
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
</resources>
|
|
@ -4084,5 +4084,4 @@
|
|||
<string name="announce_when_exceeded">Повідомляти про перевищення</string>
|
||||
<string name="user_points">Користувацькі точки</string>
|
||||
<string name="output">Вивід</string>
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
</resources>
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
-->
|
||||
|
||||
<string name="map_quick_action_pattern">%1$s → …</string>
|
||||
<string name="output">Output</string>
|
||||
<string name="user_points">User points</string>
|
||||
<string name="announce_when_exceeded">Announce when exceeded</string>
|
||||
|
|
|
@ -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,6 +31,8 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.AndroidUtils.isLayoutRtl;
|
||||
|
||||
public abstract class SwitchableAction<T> extends QuickAction {
|
||||
|
||||
public static final String KEY_ID = "id";
|
||||
|
@ -62,7 +63,7 @@ public abstract class SwitchableAction<T> 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<T> 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<T> 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<T> 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();
|
||||
|
@ -143,7 +152,7 @@ public abstract class SwitchableAction<T> extends QuickAction {
|
|||
|
||||
private List<T> 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<T> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class MapStyleAction extends SwitchableAction<String> {
|
|||
if (current != null) {
|
||||
return current.getName();
|
||||
} else {
|
||||
return RendererRegistry.DEFAULT_RENDER;
|
||||
return RendererRegistry.DEFAULT_RENDER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class MapStyleAction extends SwitchableAction<String> {
|
|||
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<String> {
|
|||
: 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));
|
||||
}
|
||||
}
|
|
@ -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<String> {
|
||||
|
||||
private final static String KEY_PROFILES = "profiles";
|
||||
|
@ -230,4 +232,11 @@ public class SwitchProfileAction extends SwitchableAction<String> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Pair<String, String>> {
|
|||
|
||||
@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<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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String, String>> {
|
|||
}
|
||||
|
||||
Pair<String, String> 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<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
|
@ -214,13 +214,4 @@ 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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
@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<Pair<String, String>> {
|
|||
|
||||
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)) {
|
||||
|
@ -226,12 +226,4 @@ 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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue