summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewConfiguration.java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-12-06 16:40:49 -0800
committerAdam Powell <adamp@google.com>2011-12-06 16:53:47 -0800
commite4b8ff8068a96fe467d2334a75198ab762bb915c (patch)
tree5b8bc531a11b5b127ae057887f8e7a6f88f261bf /core/java/android/view/ViewConfiguration.java
parented1d1838f07851484f378a3e2d6df63736aa78be (diff)
parent6a828712ad22821af867539f4d6b51bfd9ff9f0b (diff)
resolved conflicts for merge of 6a828712 to master
Change-Id: I73c804667a890bcc9924951ff655137c1345541a
Diffstat (limited to 'core/java/android/view/ViewConfiguration.java')
-rw-r--r--core/java/android/view/ViewConfiguration.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index d824e362b59d..05c5daa121a9 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -139,9 +139,17 @@ public class ViewConfiguration {
private static final int EDGE_SLOP = 12;
/**
- * Distance a touch can wander before we think the user is scrolling in dips
+ * Distance a touch can wander before we think the user is scrolling in dips.
+ * Note that this value defined here is only used as a fallback by legacy/misbehaving
+ * applications that do not provide a Context for determining density/configuration-dependent
+ * values.
+ *
+ * To alter this value, see the configuration resource config_viewConfigurationTouchSlop
+ * in frameworks/base/core/res/res/values/config.xml or the appropriate device resource overlay.
+ * It may be appropriate to tweak this on a device-specific basis in an overlay based on
+ * the characteristics of the touch panel and firmware.
*/
- private static final int TOUCH_SLOP = 16;
+ private static final int TOUCH_SLOP = 4;
/**
* Distance the first touch can wander before we stop considering this event a double tap
@@ -152,6 +160,14 @@ public class ViewConfiguration {
/**
* Distance a touch can wander before we think the user is attempting a paged scroll
* (in dips)
+ *
+ * Note that this value defined here is only used as a fallback by legacy/misbehaving
+ * applications that do not provide a Context for determining density/configuration-dependent
+ * values.
+ *
+ * See the note above on {@link #TOUCH_SLOP} regarding the dimen resource
+ * config_viewConfigurationTouchSlop. ViewConfiguration will report a paging touch slop of
+ * config_viewConfigurationTouchSlop * 2 when provided with a Context.
*/
private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
@@ -285,9 +301,6 @@ public class ViewConfiguration {
mMinimumFlingVelocity = (int) (density * MINIMUM_FLING_VELOCITY + 0.5f);
mMaximumFlingVelocity = (int) (density * MAXIMUM_FLING_VELOCITY + 0.5f);
mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
- mTouchSlop = (int) (sizeAndDensity * TOUCH_SLOP + 0.5f);
- mDoubleTapTouchSlop = (int) (sizeAndDensity * DOUBLE_TAP_TOUCH_SLOP + 0.5f);
- mPagingTouchSlop = (int) (sizeAndDensity * PAGING_TOUCH_SLOP + 0.5f);
mDoubleTapSlop = (int) (sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
mScaledTouchExplorationTapSlop = (int) (density * TOUCH_EXPLORATION_TAP_SLOP + 0.5f);
mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
@@ -310,6 +323,11 @@ public class ViewConfiguration {
mFadingMarqueeEnabled = res.getBoolean(
com.android.internal.R.bool.config_ui_enableFadingMarquee);
+ mTouchSlop = res.getDimensionPixelSize(
+ com.android.internal.R.dimen.config_viewConfigurationTouchSlop);
+ mPagingTouchSlop = mTouchSlop * 2;
+
+ mDoubleTapTouchSlop = mTouchSlop;
}
/**