summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-05-12 17:59:02 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-12 17:59:02 +0000
commit41fe70e1307b2c4f55e02d0c2c242534d6a780f4 (patch)
tree602849b63685321ddae937841dfd649c9e8e862e /core
parent33bbf3f323124d46d997459a3d31b3bc4b47d79a (diff)
parent033655636e9b936244f2ee3ae28e1363506007d4 (diff)
downloadframeworks_base-41fe70e1307b2c4f55e02d0c2c242534d6a780f4.zip
frameworks_base-41fe70e1307b2c4f55e02d0c2c242534d6a780f4.tar.gz
frameworks_base-41fe70e1307b2c4f55e02d0c2c242534d6a780f4.tar.bz2
am 5efd55a1: Merge "Fix nested scrolling bugs in AbsListView"
* commit '5efd55a1be4440efb47c28a776f9c3626a889a85': Fix nested scrolling bugs in AbsListView
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/AbsListView.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 565ea13..5fa63e5 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -743,7 +743,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
*
* @param view The view whose scroll state is being reported
*
- * @param scrollState The current scroll state. One of
+ * @param scrollState The current scroll state. One of
* {@link #SCROLL_STATE_TOUCH_SCROLL} or {@link #SCROLL_STATE_IDLE}.
*/
public void onScrollStateChanged(AbsListView view, int scrollState);
@@ -3305,18 +3305,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
private void scrollIfNeeded(int x, int y, MotionEvent vtev) {
int rawDeltaY = y - mMotionY;
+ int scrollOffsetCorrection = 0;
+ int scrollConsumedCorrection = 0;
+ if (mLastY == Integer.MIN_VALUE) {
+ rawDeltaY -= mMotionCorrection;
+ }
if (dispatchNestedPreScroll(0, rawDeltaY, mScrollConsumed, mScrollOffset)) {
rawDeltaY -= mScrollConsumed[1];
- mMotionCorrection -= mScrollOffset[1];
- if (mLastY != Integer.MIN_VALUE) {
- mLastY -= mScrollOffset[1] + mScrollConsumed[1];
- }
+ scrollOffsetCorrection -= mScrollOffset[1];
+ scrollConsumedCorrection -= mScrollConsumed[1];
if (vtev != null) {
vtev.offsetLocation(0, mScrollOffset[1]);
}
}
- final int deltaY = rawDeltaY - mMotionCorrection;
- int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
+ final int deltaY = rawDeltaY;
+ int incrementalDeltaY =
+ mLastY != Integer.MIN_VALUE ? y - mLastY - scrollConsumedCorrection : deltaY;
int lastYCorrection = 0;
if (mTouchMode == TOUCH_MODE_SCROLL) {
@@ -3378,7 +3382,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
(motionViewRealTop - motionViewPrevTop);
if (dispatchNestedScroll(0, overscroll - incrementalDeltaY, 0, overscroll,
mScrollOffset)) {
- mMotionCorrection -= mScrollOffset[1];
lastYCorrection -= mScrollOffset[1];
if (vtev != null) {
vtev.offsetLocation(0, mScrollOffset[1]);
@@ -3421,9 +3424,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
}
}
- mMotionY = y;
+ mMotionY = y + scrollOffsetCorrection;
}
- mLastY = y + lastYCorrection;
+ mLastY = y + lastYCorrection + scrollOffsetCorrection;
}
} else if (mTouchMode == TOUCH_MODE_OVERSCROLL) {
if (y != mLastY) {