mirror of https://github.com/M66B/FairEmail.git
Make swipe sensitivity dependent on screen width
This commit is contained in:
parent
858280d58b
commit
6b78f119e1
|
@ -11,10 +11,11 @@ public class SwipeListener implements View.OnTouchListener {
|
||||||
private final GestureDetector gestureDetector;
|
private final GestureDetector gestureDetector;
|
||||||
|
|
||||||
SwipeListener(final Context context, final ISwipeListener listener) {
|
SwipeListener(final Context context, final ISwipeListener listener) {
|
||||||
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
|
final int width = context.getResources().getDisplayMetrics().widthPixels;
|
||||||
private final int MOVE_THRESHOLD = Helper.dp2pixels(context, 100); // dp
|
final int MOVE_THRESHOLD = width / 2;
|
||||||
private final int SPEED_THRESHOLD = Helper.dp2pixels(context, 100); // dp
|
final int SPEED_THRESHOLD = width / 2;
|
||||||
|
|
||||||
|
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onFling(MotionEvent me1, MotionEvent me2, float vx, float vy) {
|
public boolean onFling(MotionEvent me1, MotionEvent me2, float vx, float vy) {
|
||||||
if (me1 == null || me2 == null)
|
if (me1 == null || me2 == null)
|
||||||
|
|
Loading…
Reference in New Issue