From 381c3d8de0a358a7a790ba4e3d58ec5278066c1c Mon Sep 17 00:00:00 2001 From: Corwin-Kh Date: Tue, 1 Oct 2024 15:46:33 +0300 Subject: [PATCH] Implemented set weather layer transparency on stop slider dragging --- .../weather/dialogs/WeatherLayerFragment.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/plugins/weather/dialogs/WeatherLayerFragment.java b/OsmAnd/src/net/osmand/plus/plugins/weather/dialogs/WeatherLayerFragment.java index bb4d6b3cba0..b7ce6bc7d7a 100644 --- a/OsmAnd/src/net/osmand/plus/plugins/weather/dialogs/WeatherLayerFragment.java +++ b/OsmAnd/src/net/osmand/plus/plugins/weather/dialogs/WeatherLayerFragment.java @@ -42,6 +42,7 @@ public class WeatherLayerFragment extends BaseOsmAndFragment { private static final long MS_IN_DAY = 24 * 60 * 60 * 1000; private WeatherBand weatherBand; + private boolean isSliderDragging = false; @Override protected boolean isUsedOnMap() { @@ -124,8 +125,20 @@ private void setupTransparencySliderCard(@NonNull View view) { tvCurrentValue.setText(formatAlpha(value)); slider.setValue(value); + slider.addOnSliderTouchListener(new Slider.OnSliderTouchListener() { + @Override + public void onStartTrackingTouch(@NonNull Slider slider) { + isSliderDragging = true; + } + + @Override + public void onStopTrackingTouch(@NonNull Slider slider) { + isSliderDragging = false; + } + }); + slider.addOnChangeListener((slider_, newValue, fromUser) -> { - if (fromUser) { + if (fromUser && !isSliderDragging) { weatherBand.getAlphaPreference().set(newValue); tvCurrentValue.setText(formatAlpha(newValue)); WeatherTileResourcesManager weatherTileResourcesManager = app.getWeatherHelper().getWeatherResourcesManager();