From d114b23e3095efc47f6fdcb78869d1ba6a70c1d0 Mon Sep 17 00:00:00 2001 From: cepprice Date: Sun, 28 Feb 2021 22:41:35 +0500 Subject: [PATCH] Fix logic --- OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java | 9 ++++----- .../osmand/plus/rastermaps/OsmandRasterMapsPlugin.java | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java index 4f18cb88c9..169865ab3d 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java @@ -79,16 +79,15 @@ public class RasterMapMenu { final int toggleActionStringId = mapSelected ? R.string.shared_string_on : R.string.shared_string_off; - if (mapSelected && type == RasterMapType.UNDERLAY) { - hideWaterPolygonsPref.set(hidePolygonsPref.get()); - } - final OnMapSelectedCallback onMapSelectedCallback = new OnMapSelectedCallback() { @Override public void onMapSelected(boolean canceled) { mapActivity.getDashboard().refreshContent(true); - hideWaterPolygonsPref.set(hidePolygonsPref.get()); + boolean refreshToHidePolygons = type == RasterMapType.UNDERLAY; + if (refreshToHidePolygons) { + mapActivity.refreshMapComplete(); + } } }; final MapActivityLayers mapLayers = mapActivity.getMapLayers(); diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java index ce4cf2664c..59ba2dadf7 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java @@ -106,10 +106,12 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { @Override public boolean init(@NonNull final OsmandApplication app, Activity activity) { final CommonPreference hidePolygonsPref = settings.getCustomRenderBooleanProperty("noPolygons"); + final CommonPreference hideWaterPolygonsPref = settings.getCustomRenderBooleanProperty("hideWaterPolygons"); underlayListener = new StateChangedListener() { @Override public void stateChanged(String change) { hidePolygonsPref.set(settings.MAP_UNDERLAY.get() != null); + hideWaterPolygonsPref.set(settings.MAP_UNDERLAY.get() != null); } }; settings.MAP_UNDERLAY.addListener(underlayListener);