diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2410f65d5c..caa37d1d0a 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -10,7 +10,7 @@ - For wording and consistency, please note https://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience Thx - Hardy ---> +--> mode Learn more about how OsmAnd calculates routes in our blog. Public transport routes are now in the beta testing phase, so errors and inaccuracies may occur. Add intermediate point diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java index 4441573263..a3e6e6b1b5 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java @@ -7,6 +7,7 @@ import android.view.ViewGroup; import android.widget.TextView; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; +import net.osmand.plus.OsmandSettings.DayNightMode; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; @@ -25,14 +26,8 @@ public class DayNightModeAction extends QuickAction { activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT); break; } - case NIGHT: { - activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY); - break; - } - case AUTO: { - activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY); - break; - } + case NIGHT: + case AUTO: case SENSOR: { activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY); break; @@ -44,7 +39,6 @@ public class DayNightModeAction extends QuickAction { public void drawUI(ViewGroup parent, MapActivity activity) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.quick_action_with_text, parent, false); - ((TextView) view.findViewById(R.id.text)) .setText(R.string.quick_action_switch_day_night_descr); @@ -53,24 +47,20 @@ public class DayNightModeAction extends QuickAction { @Override public int getIconRes(Context context) { - if(context instanceof MapActivity) { - switch (((MapActivity) context).getMyApplication().getSettings().DAYNIGHT_MODE.get()) { - case NIGHT: { - return R.drawable.ic_action_map_night; - } - case AUTO: { - return R.drawable.ic_action_map_sunst; - } - case SENSOR: { - return R.drawable.ic_action_map_light_sensor; - } - } + if (context instanceof MapActivity + && ((MapActivity) context).getMyApplication().getSettings().DAYNIGHT_MODE.get() == DayNightMode.DAY) { + return R.drawable.ic_action_map_night; } return R.drawable.ic_action_map_day; } @Override public String getActionText(OsmandApplication application) { - return application.getSettings().DAYNIGHT_MODE.get().toHumanString(application) + " Mode"; + if (application.getSettings().DAYNIGHT_MODE.get() == DayNightMode.DAY) { + return DayNightMode.NIGHT.toHumanString(application) + " " + application.getString(R.string.shared_string_mode); + } else { + return DayNightMode.DAY.toHumanString(application) + " " + application.getString(R.string.shared_string_mode); + } + } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java index 521a72a120..6cabfe0d3f 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java @@ -44,6 +44,7 @@ import net.osmand.plus.quickaction.QuickActionsWidget; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; +import net.osmand.plus.quickaction.actions.DayNightModeAction; import static net.osmand.plus.views.ContextMenuLayer.VIBRATE_SHORT; @@ -420,8 +421,13 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe @Override public void onActionSelected(QuickAction action) { - setLayerState(false); - QuickActionFactory.produceAction(action).execute(mapActivity); + if (action instanceof DayNightModeAction) { + setLayerState(false); + QuickActionFactory.produceAction(action).execute(mapActivity); + } else { + QuickActionFactory.produceAction(action).execute(mapActivity); + setLayerState(false); + } } public PointF getMovableCenterPoint(RotatedTileBox tb) {