diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 62699472ba..406fc329e0 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1984,13 +1984,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. @Override public float getSwipeEscapeVelocity(float defaultValue) { - int swipe_sensitivity = 10; + int swipe_sensitivity = FragmentOptionsBehavior.DEFAULT_SWIPE_SENSITIVITY; Context context = getContext(); if (context != null) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - swipe_sensitivity = prefs.getInt("swipe_sensitivity", 10); + swipe_sensitivity = prefs.getInt("swipe_sensitivity", swipe_sensitivity); } - return super.getSwipeEscapeVelocity(defaultValue) * (10 - swipe_sensitivity + 1); + return super.getSwipeEscapeVelocity(defaultValue) * + (FragmentOptionsBehavior.MAX_SWIPE_SENSITIVITY - swipe_sensitivity + 1); } @Override diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java index 2baf9f24be..9f997e2c50 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java @@ -91,6 +91,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe private SwitchCompat swAutoImportant; private SwitchCompat swResetImportance; + final static int MAX_SWIPE_SENSITIVITY = 10; + final static int DEFAULT_SWIPE_SENSITIVITY = 7; + private final static String[] RESET_OPTIONS = new String[]{ "sync_on_launch", "double_back", "conversation_actions", "conversation_actions_replies", "language_detection", "default_snooze", @@ -249,6 +252,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe } }); + sbSwipeSensitivity.setMax(MAX_SWIPE_SENSITIVITY); + sbSwipeSensitivity.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { @@ -487,7 +492,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swQuickFilter.setChecked(prefs.getBoolean("quick_filter", false)); swQuickScroll.setChecked(prefs.getBoolean("quick_scroll", true)); - int swipe_sensitivity = prefs.getInt("swipe_sensitivity", 10); + int swipe_sensitivity = prefs.getInt("swipe_sensitivity", DEFAULT_SWIPE_SENSITIVITY); sbSwipeSensitivity.setProgress(swipe_sensitivity); swDoubleTap.setChecked(prefs.getBoolean("doubletap", true)); diff --git a/app/src/main/res/layout/fragment_options_behavior.xml b/app/src/main/res/layout/fragment_options_behavior.xml index aafc3363c8..6085c14793 100644 --- a/app/src/main/res/layout/fragment_options_behavior.xml +++ b/app/src/main/res/layout/fragment_options_behavior.xml @@ -289,8 +289,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:max="10" - android:min="1" - android:progress="10" + android:progress="7" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvSwipeSensitivity" />