Added ViewConfiguration.getScaledPagingTouchSlop()
Change-Id: I9ab5560c4b76d2b87e53d38b10ba8f5ec4868d85
diff --git a/api/current.xml b/api/current.xml
index ed3f6965..8d15665 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -179390,6 +179390,17 @@
visibility="public"
>
</method>
+<method name="getScaledPagingTouchSlop"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getScaledScrollBarSize"
return="int"
abstract="false"
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 2344c42..2b78d2d 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -102,6 +102,12 @@
private static final int TOUCH_SLOP = 16;
/**
+ * Distance a touch can wander before we think the user is attempting a paged scroll
+ * (in dips)
+ */
+ private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 3;
+
+ /**
* Distance between the first touch and second touch to still be considered a double tap
*/
private static final int DOUBLE_TAP_SLOP = 100;
@@ -140,6 +146,7 @@
private final int mMaximumFlingVelocity;
private final int mScrollbarSize;
private final int mTouchSlop;
+ private final int mPagingTouchSlop;
private final int mDoubleTapSlop;
private final int mWindowTouchSlop;
private final int mMaximumDrawingCacheSize;
@@ -158,6 +165,7 @@
mMaximumFlingVelocity = MAXIMUM_FLING_VELOCITY;
mScrollbarSize = SCROLL_BAR_SIZE;
mTouchSlop = TOUCH_SLOP;
+ mPagingTouchSlop = PAGING_TOUCH_SLOP;
mDoubleTapSlop = DOUBLE_TAP_SLOP;
mWindowTouchSlop = WINDOW_TOUCH_SLOP;
//noinspection deprecation
@@ -184,6 +192,7 @@
mMaximumFlingVelocity = (int) (density * MAXIMUM_FLING_VELOCITY + 0.5f);
mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
mTouchSlop = (int) (density * 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);
@@ -339,6 +348,14 @@
public int getScaledTouchSlop() {
return mTouchSlop;
}
+
+ /**
+ * @return Distance a touch can wander before we think the user is scrolling a full page
+ * in dips
+ */
+ public int getScaledPagingTouchSlop() {
+ return mPagingTouchSlop;
+ }
/**
* @return Distance between the first touch and second touch to still be