summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewConfiguration.java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-08-25 14:37:03 -0700
committerAdam Powell <adamp@google.com>2010-11-23 09:30:10 -0800
commit637d337b58d8eec6de19230a5dd5ca5581c0478d (patch)
tree763894435a1f31800765809f49caf4468090755b /core/java/android/view/ViewConfiguration.java
parente56764a8fd1cb45298d61a26e844d75ae4449f93 (diff)
Merge overscrolling from gingerbread.
Change-Id: I3eb4413261b38ddd8c609d6153bdfd4ae46c6a0f
Diffstat (limited to 'core/java/android/view/ViewConfiguration.java')
-rw-r--r--core/java/android/view/ViewConfiguration.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 85981d2137dc..bb8589498244 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -144,7 +144,7 @@ public class ViewConfiguration {
/**
* Maximum velocity to initiate a fling, as measured in pixels per second
*/
- private static final int MAXIMUM_FLING_VELOCITY = 4000;
+ private static final int MAXIMUM_FLING_VELOCITY = 8000;
/**
* The maximum size of View's drawing cache, expressed in bytes. This size
@@ -158,6 +158,16 @@ public class ViewConfiguration {
*/
private static float SCROLL_FRICTION = 0.015f;
+ /**
+ * Max distance to overscroll for edge effects
+ */
+ private static final int OVERSCROLL_DISTANCE = 0;
+
+ /**
+ * Max distance to overfling for edge effects
+ */
+ private static final int OVERFLING_DISTANCE = 4;
+
private final int mEdgeSlop;
private final int mFadingEdgeLength;
private final int mMinimumFlingVelocity;
@@ -168,6 +178,8 @@ public class ViewConfiguration {
private final int mDoubleTapSlop;
private final int mWindowTouchSlop;
private final int mMaximumDrawingCacheSize;
+ private final int mOverscrollDistance;
+ private final int mOverflingDistance;
private static final SparseArray<ViewConfiguration> sConfigurations =
new SparseArray<ViewConfiguration>(2);
@@ -188,6 +200,8 @@ public class ViewConfiguration {
mWindowTouchSlop = WINDOW_TOUCH_SLOP;
//noinspection deprecation
mMaximumDrawingCacheSize = MAXIMUM_DRAWING_CACHE_SIZE;
+ mOverscrollDistance = OVERSCROLL_DISTANCE;
+ mOverflingDistance = OVERFLING_DISTANCE;
}
/**
@@ -216,6 +230,9 @@ public class ViewConfiguration {
// Size of the screen in bytes, in ARGB_8888 format
mMaximumDrawingCacheSize = 4 * metrics.widthPixels * metrics.heightPixels;
+
+ mOverscrollDistance = (int) (density * OVERSCROLL_DISTANCE + 0.5f);
+ mOverflingDistance = (int) (density * OVERFLING_DISTANCE + 0.5f);
}
/**
@@ -473,6 +490,20 @@ public class ViewConfiguration {
}
/**
+ * @return The maximum distance a View should overscroll by when showing edge effects.
+ */
+ public int getScaledOverscrollDistance() {
+ return mOverscrollDistance;
+ }
+
+ /**
+ * @return The maximum distance a View should overfling by when showing edge effects.
+ */
+ public int getScaledOverflingDistance() {
+ return mOverflingDistance;
+ }
+
+ /**
* The amount of time that the zoom controls should be
* displayed on the screen expressed in milliseconds.
*