Changed default swipe sensitivity

pull/200/head
M66B 4 years ago
parent d98b4372c0
commit aaacabe593

@ -1984,13 +1984,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override @Override
public float getSwipeEscapeVelocity(float defaultValue) { public float getSwipeEscapeVelocity(float defaultValue) {
int swipe_sensitivity = 10; int swipe_sensitivity = FragmentOptionsBehavior.DEFAULT_SWIPE_SENSITIVITY;
Context context = getContext(); Context context = getContext();
if (context != null) { if (context != null) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); 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 @Override

@ -91,6 +91,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoImportant; private SwitchCompat swAutoImportant;
private SwitchCompat swResetImportance; 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[]{ private final static String[] RESET_OPTIONS = new String[]{
"sync_on_launch", "double_back", "conversation_actions", "conversation_actions_replies", "language_detection", "sync_on_launch", "double_back", "conversation_actions", "conversation_actions_replies", "language_detection",
"default_snooze", "default_snooze",
@ -249,6 +252,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
} }
}); });
sbSwipeSensitivity.setMax(MAX_SWIPE_SENSITIVITY);
sbSwipeSensitivity.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { sbSwipeSensitivity.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 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)); swQuickFilter.setChecked(prefs.getBoolean("quick_filter", false));
swQuickScroll.setChecked(prefs.getBoolean("quick_scroll", true)); 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); sbSwipeSensitivity.setProgress(swipe_sensitivity);
swDoubleTap.setChecked(prefs.getBoolean("doubletap", true)); swDoubleTap.setChecked(prefs.getBoolean("doubletap", true));

@ -289,8 +289,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:max="10" android:max="10"
android:min="1" android:progress="7"
android:progress="10"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSwipeSensitivity" /> app:layout_constraintTop_toBottomOf="@id/tvSwipeSensitivity" />

Loading…
Cancel
Save