From 2e27035a1633d39cf39184ebf92509b9b8a176d5 Mon Sep 17 00:00:00 2001 From: sergosm Date: Tue, 22 Sep 2020 10:55:16 +0300 Subject: [PATCH] Transparency seekbar on the map and UI are not synchronized --- OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java | 1 + .../osmand/plus/views/layers/MapControlsLayer.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java index 44d50db194..534c334aec 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/RasterMapMenu.java @@ -149,6 +149,7 @@ public class RasterMapMenu { @Override public boolean onIntegerValueChangedListener(int newValue) { mapTransparencyPreference.set(newValue); + mapActivity.getMapLayers().getMapControlsLayer().updateTransparencySlider(); mapActivity.getMapView().refreshMap(); return false; } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java index 21277e2426..f1c3c1f13a 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java @@ -1068,6 +1068,17 @@ public class MapControlsLayer extends OsmandMapLayer { } } + public void updateTransparencySlider () { + LayerTransparencySeekbarMode seekbarMode = settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get(); + if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null) { + if (seekbarMode == LayerTransparencySeekbarMode.OVERLAY && settings.MAP_OVERLAY.get() != null) { + transparencySlider.setValue(settings.MAP_OVERLAY_TRANSPARENCY.get()); + } else if (seekbarMode == LayerTransparencySeekbarMode.UNDERLAY && settings.MAP_UNDERLAY.get() != null) { + transparencySlider.setValue(settings.MAP_TRANSPARENCY.get()); + } + } + } + public void showTransparencyBar(CommonPreference transparenPreference, boolean isTransparencyBarEnabled) { this.isTransparencyBarEnabled = isTransparencyBarEnabled;