diff options
| author | Masanori Ogino <ogino.masanori@sharp.co.jp> | 2011-01-14 13:24:20 +0900 |
|---|---|---|
| committer | Masanori Ogino <ogino.masanori@sharp.co.jp> | 2011-02-07 17:05:45 +0900 |
| commit | 40209532bff0f83cbbdf408bb3f6e8142e7b02cd (patch) | |
| tree | 95e0b62d40c02eed9176d0da065c1db630dcf597 /core/java/android/view/ViewConfiguration.java | |
| parent | a220a2979937700024662be0f8fc166ca65506ed (diff) | |
Adjust mBiggerTouchSlopSquare to the suitable value
If the scaling factor is larger than 1.0 (i.e. 1.5),
then mTouchSlopSquare(576) is bigger than mBiggerTouchSlopSquare(400).
The double tap condition should be bigger than a single tap's one.
This causes the fail of the following CTS test cases in the device has
over 240 density.
- android.view.cts.GestureDetectorTest
* testOnTouchEvent
- android.view.cts.GestureDetector_SimpleOnGestureListenerTest
* testSimpleOnGestureListener
To fix this issue, I'll add a new public method
ViewConfiguration#getScaledLargeTouchSlop() then the value returned
from that method is used as a slop area of mLargeTouchSlop.
Change-Id: I0e61c13670e1300be1ccf45a89ef89410496fb48
Diffstat (limited to 'core/java/android/view/ViewConfiguration.java')
| -rwxr-xr-x[-rw-r--r--] | core/java/android/view/ViewConfiguration.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index 924c9d48f5d4..5397449f806b 100644..100755 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -102,6 +102,12 @@ public class ViewConfiguration { private static final int TOUCH_SLOP = 16; /** + * Distance a touch can wander before we think the user is the first touch + * in a sequence of double tap + */ + private static final int LARGE_TOUCH_SLOP = 18; + + /** * Distance a touch can wander before we think the user is attempting a paged scroll * (in dips) */ @@ -156,6 +162,7 @@ public class ViewConfiguration { private final int mMaximumFlingVelocity; private final int mScrollbarSize; private final int mTouchSlop; + private final int mLargeTouchSlop; private final int mPagingTouchSlop; private final int mDoubleTapSlop; private final int mWindowTouchSlop; @@ -177,6 +184,7 @@ public class ViewConfiguration { mMaximumFlingVelocity = MAXIMUM_FLING_VELOCITY; mScrollbarSize = SCROLL_BAR_SIZE; mTouchSlop = TOUCH_SLOP; + mLargeTouchSlop = LARGE_TOUCH_SLOP; mPagingTouchSlop = PAGING_TOUCH_SLOP; mDoubleTapSlop = DOUBLE_TAP_SLOP; mWindowTouchSlop = WINDOW_TOUCH_SLOP; @@ -206,6 +214,7 @@ public class ViewConfiguration { mMaximumFlingVelocity = (int) (density * MAXIMUM_FLING_VELOCITY + 0.5f); mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f); mTouchSlop = (int) (density * TOUCH_SLOP + 0.5f); + mLargeTouchSlop = (int) (density * LARGE_TOUCH_SLOP + 0.5f); mPagingTouchSlop = (int) (density * PAGING_TOUCH_SLOP + 0.5f); mDoubleTapSlop = (int) (density * DOUBLE_TAP_SLOP + 0.5f); mWindowTouchSlop = (int) (density * WINDOW_TOUCH_SLOP + 0.5f); @@ -367,6 +376,14 @@ public class ViewConfiguration { } /** + * @return Distance a touch can wander before we think the user is the first touch + * in a sequence of double tap + */ + public int getScaledLargeTouchSlop() { + return mLargeTouchSlop; + } + + /** * @return Distance a touch can wander before we think the user is scrolling a full page * in dips */ |
