From dac640f40350608158896fa2613836600c1e2339 Mon Sep 17 00:00:00 2001 From: Masanori Ogino Date: Mon, 20 Feb 2012 11:46:12 +0900 Subject: [PATCH] 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 --- core/java/android/view/GestureDetector.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 core/java/android/view/GestureDetector.java diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java old mode 100644 new mode 100755 index a496a9ea0c8ce..5c8b23639ba4e --- a/core/java/android/view/GestureDetector.java +++ b/core/java/android/view/GestureDetector.java @@ -193,8 +193,7 @@ public class GestureDetector { } } - // TODO: ViewConfiguration - private int mBiggerTouchSlopSquare = 20 * 20; + private int mBiggerTouchSlopSquare; private int mTouchSlopSquare; private int mDoubleTapSlopSquare; @@ -408,6 +407,14 @@ public class GestureDetector { } mTouchSlopSquare = touchSlop * touchSlop; mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop; + + // The biggerTouchSlop should be a little bit bigger than touchSlop + // and mBiggerTouchSlopSquare should not be over mDoubleTapSlopSquare. + int biggerTouchSlop = (int)(touchSlop * 1.25f); + mBiggerTouchSlopSquare = biggerTouchSlop * biggerTouchSlop; + if (mBiggerTouchSlopSquare > mDoubleTapSlopSquare) { + mBiggerTouchSlopSquare = mDoubleTapSlopSquare; + } } /**