summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewConfiguration.java
diff options
context:
space:
mode:
authorNed Burns <pixel@google.com>2016-08-17 17:30:25 -0400
committerNed Burns <pixel@google.com>2016-08-18 15:07:05 -0400
commit69af432039ab26492dd751d74b68a217e59589fa (patch)
tree464f2c1a56405b5089a554fcf65978fbd0c0a889 /core/java/android/view/ViewConfiguration.java
parent58a00115d935ee44ac113ea68253e440dbd24087 (diff)
Add ViewConfiguration.getScaledScrollFactor()
This value is used to convert ACTION_SCROLL axis values into raw pixel distances. Change-Id: I537af010610bb374ab29a41aff4fae5b07bece6e
Diffstat (limited to 'core/java/android/view/ViewConfiguration.java')
-rw-r--r--core/java/android/view/ViewConfiguration.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 9a73d0b1bfaa..33b488fbc6b4 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -219,6 +219,12 @@ public class ViewConfiguration {
private static final int OVERFLING_DISTANCE = 6;
/**
+ * Amount to scroll in response to a {@link MotionEvent#ACTION_SCROLL} event, in dips per
+ * axis value.
+ */
+ private static final int SCROLL_FACTOR = 64;
+
+ /**
* Default duration to hide an action mode for.
*/
private static final long ACTION_MODE_HIDE_DURATION_DEFAULT = 2000;
@@ -246,6 +252,7 @@ public class ViewConfiguration {
private final int mOverflingDistance;
private final boolean mFadingMarqueeEnabled;
private final long mGlobalActionsKeyTimeout;
+ private final int mScrollFactor;
private boolean sHasPermanentMenuKey;
private boolean sHasPermanentMenuKeySet;
@@ -274,6 +281,7 @@ public class ViewConfiguration {
mOverflingDistance = OVERFLING_DISTANCE;
mFadingMarqueeEnabled = true;
mGlobalActionsKeyTimeout = GLOBAL_ACTIONS_KEY_TIMEOUT;
+ mScrollFactor = SCROLL_FACTOR;
}
/**
@@ -357,6 +365,8 @@ public class ViewConfiguration {
com.android.internal.R.dimen.config_viewMaxFlingVelocity);
mGlobalActionsKeyTimeout = res.getInteger(
com.android.internal.R.integer.config_globalActionsKeyTimeout);
+ mScrollFactor = res.getDimensionPixelSize(
+ com.android.internal.R.dimen.config_scrollFactor);
}
/**
@@ -669,6 +679,14 @@ public class ViewConfiguration {
}
/**
+ * @return Amount to scroll in response to a {@link MotionEvent#ACTION_SCROLL} event. Multiply
+ * this by the event's axis value to obtain the number of pixels to be scrolled.
+ */
+ public int getScaledScrollFactor() {
+ return mScrollFactor;
+ }
+
+ /**
* The maximum drawing cache size expressed in bytes.
*
* @return the maximum size of View's drawing cache expressed in bytes