Make swipe sensitivity dependent on screen width

This commit is contained in:
M66B 2019-05-03 13:51:24 +02:00
parent 858280d58b
commit 6b78f119e1
1 changed files with 4 additions and 3 deletions

View File

@ -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)