Add check for first state update

This commit is contained in:
Vitaliy 2020-05-21 16:45:57 +03:00
parent 5fe6df8dc1
commit 9c421464df

View file

@ -74,7 +74,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
private boolean isLayerOn; private boolean isLayerOn;
private boolean nightMode; private boolean nightMode;
private boolean currentWidgetState; private Boolean currentWidgetState;
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) { public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
this.mapActivity = activity; this.mapActivity = activity;
@ -210,7 +210,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
*/ */
public boolean setLayerState(boolean showWidget) { public boolean setLayerState(boolean showWidget) {
// check if state change is needed // check if state change is needed
if (currentWidgetState == showWidget) { if (currentWidgetState != null && currentWidgetState == showWidget) {
return false; return false;
} }
currentWidgetState = showWidget; currentWidgetState = showWidget;