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
|
- For wording and consistency, please note https://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience
|
||||||
Thx - Hardy
|
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_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="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>
|
<string name="add_intermediate">Add intermediate point</string>
|
||||||
|
|
|
@ -57,9 +57,9 @@ public class DayNightModeAction extends QuickAction {
|
||||||
@Override
|
@Override
|
||||||
public String getActionText(OsmandApplication application) {
|
public String getActionText(OsmandApplication application) {
|
||||||
if (application.getSettings().DAYNIGHT_MODE.get() == DayNightMode.DAY) {
|
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 {
|
} 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 isLayerOn;
|
||||||
|
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
|
private boolean prevWidgetState;
|
||||||
|
|
||||||
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
|
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
|
||||||
this.mapActivity = activity;
|
this.mapActivity = activity;
|
||||||
|
@ -205,6 +206,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
* @return true, if state was changed
|
* @return true, if state was changed
|
||||||
*/
|
*/
|
||||||
public boolean setLayerState(boolean showWidget) {
|
public boolean setLayerState(boolean showWidget) {
|
||||||
|
prevWidgetState = showWidget;
|
||||||
if (isWidgetVisible() == showWidget) // check if state change is needed
|
if (isWidgetVisible() == showWidget) // check if state change is needed
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -373,14 +375,14 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
|
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
|
||||||
boolean nightMode = settings != null && settings.isNightMode();
|
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
if (isInMovingMarkerMode()) {
|
if (isInMovingMarkerMode()) {
|
||||||
canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
|
canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
|
||||||
contextMarker.draw(canvas);
|
contextMarker.draw(canvas);
|
||||||
}
|
}
|
||||||
if (this.nightMode != nightMode) {
|
if (this.nightMode != nightMode) {
|
||||||
this.nightMode = nightMode;
|
this.nightMode = nightMode;
|
||||||
updateQuickActionButton(isWidgetVisible());
|
updateQuickActionButton(prevWidgetState);
|
||||||
}
|
}
|
||||||
setupQuickActionBtnVisibility();
|
setupQuickActionBtnVisibility();
|
||||||
}
|
}
|
||||||
|
@ -421,13 +423,8 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActionSelected(QuickAction action) {
|
public void onActionSelected(QuickAction action) {
|
||||||
if (action instanceof DayNightModeAction) {
|
QuickActionFactory.produceAction(action).execute(mapActivity);
|
||||||
setLayerState(false);
|
setLayerState(false);
|
||||||
QuickActionFactory.produceAction(action).execute(mapActivity);
|
|
||||||
} else {
|
|
||||||
QuickActionFactory.produceAction(action).execute(mapActivity);
|
|
||||||
setLayerState(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointF getMovableCenterPoint(RotatedTileBox tb) {
|
public PointF getMovableCenterPoint(RotatedTileBox tb) {
|
||||||
|
|
Loading…
Reference in a new issue