From 6b78f119e1292a7d6295d34a6bdcb0ca3d15b6e4 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 3 May 2019 13:51:24 +0200 Subject: [PATCH] Make swipe sensitivity dependent on screen width --- app/src/main/java/eu/faircode/email/SwipeListener.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/SwipeListener.java b/app/src/main/java/eu/faircode/email/SwipeListener.java index 6f3e7c3c14..594cd39049 100644 --- a/app/src/main/java/eu/faircode/email/SwipeListener.java +++ b/app/src/main/java/eu/faircode/email/SwipeListener.java @@ -11,10 +11,11 @@ public class SwipeListener implements View.OnTouchListener { private final GestureDetector gestureDetector; SwipeListener(final Context context, final ISwipeListener listener) { - gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { - private final int MOVE_THRESHOLD = Helper.dp2pixels(context, 100); // dp - private final int SPEED_THRESHOLD = Helper.dp2pixels(context, 100); // dp + final int width = context.getResources().getDisplayMetrics().widthPixels; + final int MOVE_THRESHOLD = width / 2; + final int SPEED_THRESHOLD = width / 2; + gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onFling(MotionEvent me1, MotionEvent me2, float vx, float vy) { if (me1 == null || me2 == null)