Quickaction mode fix
This commit is contained in:
parent
77cfcf6feb
commit
03791f32a4
3 changed files with 9 additions and 12 deletions
|
@ -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
|
||||
|
||||
--> <string name="shared_string_mode">mode</string>
|
||||
--> <string name="quick_action_day_night_mode">%s mode</string>
|
||||
<string name="public_transport_warning_descr_blog">Learn more about how OsmAnd calculates routes in our blog.</string>
|
||||
<string name="public_transport_warning_title">Public transport routes are now in the beta testing phase, so errors and inaccuracies may occur.</string>
|
||||
<string name="add_intermediate">Add intermediate point</string>
|
||||
|
|
|
@ -57,9 +57,9 @@ public class DayNightModeAction extends QuickAction {
|
|||
@Override
|
||||
public String getActionText(OsmandApplication application) {
|
||||
if (application.getSettings().DAYNIGHT_MODE.get() == DayNightMode.DAY) {
|
||||
return DayNightMode.NIGHT.toHumanString(application) + " " + application.getString(R.string.shared_string_mode);
|
||||
return String.format(application.getString(R.string.quick_action_day_night_mode), DayNightMode.NIGHT.toHumanString(application));
|
||||
} else {
|
||||
return DayNightMode.DAY.toHumanString(application) + " " + application.getString(R.string.shared_string_mode);
|
||||
return String.format(application.getString(R.string.quick_action_day_night_mode), DayNightMode.DAY.toHumanString(application));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
private boolean isLayerOn;
|
||||
|
||||
private boolean nightMode;
|
||||
private boolean prevWidgetState;
|
||||
|
||||
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
|
||||
this.mapActivity = activity;
|
||||
|
@ -205,6 +206,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
* @return true, if state was changed
|
||||
*/
|
||||
public boolean setLayerState(boolean showWidget) {
|
||||
prevWidgetState = showWidget;
|
||||
if (isWidgetVisible() == showWidget) // check if state change is needed
|
||||
return false;
|
||||
|
||||
|
@ -373,14 +375,14 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
|
||||
boolean nightMode = settings != null && settings.isNightMode();
|
||||
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
if (isInMovingMarkerMode()) {
|
||||
canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
|
||||
contextMarker.draw(canvas);
|
||||
}
|
||||
if (this.nightMode != nightMode) {
|
||||
this.nightMode = nightMode;
|
||||
updateQuickActionButton(isWidgetVisible());
|
||||
updateQuickActionButton(prevWidgetState);
|
||||
}
|
||||
setupQuickActionBtnVisibility();
|
||||
}
|
||||
|
@ -421,14 +423,9 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
|
||||
@Override
|
||||
public void onActionSelected(QuickAction action) {
|
||||
if (action instanceof DayNightModeAction) {
|
||||
setLayerState(false);
|
||||
QuickActionFactory.produceAction(action).execute(mapActivity);
|
||||
} else {
|
||||
QuickActionFactory.produceAction(action).execute(mapActivity);
|
||||
setLayerState(false);
|
||||
}
|
||||
}
|
||||
|
||||
public PointF getMovableCenterPoint(RotatedTileBox tb) {
|
||||
return new PointF(tb.getPixWidth() / 2, tb.getPixHeight() / 2);
|
||||
|
|
Loading…
Reference in a new issue