Skip to content

Commit dac640f

Browse files
committed
The bigger touch slop still has a problem
I had submitted the patch about this issue at https://android-review.googlesource.com/#/c/20438/ before. But it has never been included in any version. In the latest implementation, touchSlop is a configurable value which is declared in config.xml for each device. First of all, the problem is that BiggerTouchSlop is not scalable and variable value according to a configured touchSlop. I don't think that there should be a new api in ViewConfiguration for this. Because the bigger touch slop is a local threshold value in GestureDetector. The only thing to be satisfied is that the value should be bigger than configured touch slop and should not be over double touch slop. Change-Id: I2c6662400fcffb4a7192ede4ac8da08559aa7948
1 parent 472512f commit dac640f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/java/android/view/GestureDetector.java

100644100755
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ public boolean onSingleTapConfirmed(MotionEvent e) {
193193
}
194194
}
195195

196-
// TODO: ViewConfiguration
197-
private int mBiggerTouchSlopSquare = 20 * 20;
196+
private int mBiggerTouchSlopSquare;
198197

199198
private int mTouchSlopSquare;
200199
private int mDoubleTapSlopSquare;
@@ -408,6 +407,14 @@ private void init(Context context, boolean ignoreMultitouch) {
408407
}
409408
mTouchSlopSquare = touchSlop * touchSlop;
410409
mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
410+
411+
// The biggerTouchSlop should be a little bit bigger than touchSlop
412+
// and mBiggerTouchSlopSquare should not be over mDoubleTapSlopSquare.
413+
int biggerTouchSlop = (int)(touchSlop * 1.25f);
414+
mBiggerTouchSlopSquare = biggerTouchSlop * biggerTouchSlop;
415+
if (mBiggerTouchSlopSquare > mDoubleTapSlopSquare) {
416+
mBiggerTouchSlopSquare = mDoubleTapSlopSquare;
417+
}
411418
}
412419

413420
/**

0 commit comments

Comments
 (0)