summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMindy Pereira <mindyp@google.com>2010-10-01 16:37:06 -0700
committerMindy Pereira <mindyp@google.com>2010-10-03 12:52:11 -0700
commite6c4747276cd4e7f0243bcd8ea50ad3e66609fef (patch)
tree1f901c5cf9a774d6608a0d17e2def1f790acd8c4
parent2942391801b79816c5eb77d7ac94c4a65f26af48 (diff)
downloadframeworks_base-e6c4747276cd4e7f0243bcd8ea50ad3e66609fef.zip
frameworks_base-e6c4747276cd4e7f0243bcd8ea50ad3e66609fef.tar.gz
frameworks_base-e6c4747276cd4e7f0243bcd8ea50ad3e66609fef.tar.bz2
DO NOT MERGE. Fix logic for switching between overscroll and scroll modes.
The issue here was originally that webview was showing twice as intense of an effect for edge glow as lists. The root cause was that abslistview was calling onPull half as often as webview. This occurred because every time an action_move came into the touch handler for abslistview when it was in overscroll, the mode was ALWAYS changed back to scroll mode. Therefore, half the action_move events were essentially being eating by the abslistview state machine. After fixing that issue, needed to decrease the intensity of the effect for webview and abslistview by halving the PULL_DISTANCE_GLOW_FACTOR. Change-Id: I5dbdf4f1219f3bb157a71d4fccf8fa42e2abe047
-rw-r--r--core/java/android/widget/AbsListView.java15
-rw-r--r--core/java/android/widget/EdgeGlow.java2
2 files changed, 14 insertions, 3 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 8f5c35e..4558854 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -521,6 +521,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
private int mLastPositionDistanceGuess;
/**
+ * Used for determining when to cancel out of overscroll.
+ */
+ private int mDirection = 0;
+
+ /**
* Interface definition for a callback to be invoked when the list or grid
* has been scrolled.
*/
@@ -2238,6 +2243,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
if (overscrollMode == OVERSCROLL_ALWAYS ||
(overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS &&
!contentFits())) {
+ mDirection = 0; // Reset when entering overscroll.
mTouchMode = TOUCH_MODE_OVERSCROLL;
if (rawDeltaY > 0) {
mEdgeGlowTop.onPull((float) overscroll / getHeight());
@@ -2261,9 +2267,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
final int oldScroll = mScrollY;
final int newScroll = oldScroll - incrementalDeltaY;
+ int newDirection = y > mLastY ? 1 : -1;
+
+ if (mDirection == 0) {
+ mDirection = newDirection;
+ }
- if ((oldScroll >= 0 && newScroll <= 0) ||
- (oldScroll <= 0 && newScroll >= 0)) {
+ if (mDirection != newDirection) {
// Coming back to 'real' list scrolling
incrementalDeltaY = -newScroll;
mScrollY = 0;
@@ -2308,6 +2318,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
}
mLastY = y;
+ mDirection = newDirection;
}
break;
}
diff --git a/core/java/android/widget/EdgeGlow.java b/core/java/android/widget/EdgeGlow.java
index e24f495..1f7daab 100644
--- a/core/java/android/widget/EdgeGlow.java
+++ b/core/java/android/widget/EdgeGlow.java
@@ -90,7 +90,7 @@ public class EdgeGlow {
// How much dragging should effect the height of the glow image.
// Number determined by user testing.
- private static final int PULL_DISTANCE_GLOW_FACTOR = 10;
+ private static final int PULL_DISTANCE_GLOW_FACTOR = 5;
private static final int VELOCITY_EDGE_FACTOR = 8;
private static final int VELOCITY_GLOW_FACTOR = 16;