Fix logic

This commit is contained in:
cepprice 2021-02-28 22:41:35 +05:00
parent b8f3452a1c
commit d114b23e30
2 changed files with 6 additions and 5 deletions

View file

@ -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();

View file

@ -106,10 +106,12 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
@Override
public boolean init(@NonNull final OsmandApplication app, Activity activity) {
final CommonPreference<Boolean> hidePolygonsPref = settings.getCustomRenderBooleanProperty("noPolygons");
final CommonPreference<Boolean> hideWaterPolygonsPref = settings.getCustomRenderBooleanProperty("hideWaterPolygons");
underlayListener = new StateChangedListener<String>() {
@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);