Skip to content

Commit

Permalink
Implemented set weather layer transparency on stop slider dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
Corwin-Kh committed Oct 1, 2024
1 parent 4cc7fc9 commit 381c3d8
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 381c3d8

Please sign in to comment.