diff options
author | Yorke Lee <yorkelee@google.com> | 2014-05-02 18:33:35 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-05-05 14:29:34 -0700 |
commit | e9a0d6a859961bf97e9e7a0d06b2c47c7516e9b7 (patch) | |
tree | aa81db92aa18f26d222b9e2fea8d2259d544cf37 | |
parent | ce8083fc51d71f104222d90a6736e52bccb33b7f (diff) | |
download | frameworks_base-e9a0d6a859961bf97e9e7a0d06b2c47c7516e9b7.zip frameworks_base-e9a0d6a859961bf97e9e7a0d06b2c47c7516e9b7.tar.gz frameworks_base-e9a0d6a859961bf97e9e7a0d06b2c47c7516e9b7.tar.bz2 |
Fix nested prescrolling bug in ScrollView
mScrollOffset should not be applied to deltaY for the current
MotionEvent. Instead, it should be used to offset the y position
of the next motion event instead.
Change-Id: Iaed85083556d4606300d9a888662c32ab4dbf3ca
-rw-r--r-- | core/java/android/widget/ScrollView.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 8dfef25a..0fa75a6 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -628,7 +628,7 @@ public class ScrollView extends FrameLayout { final int y = (int) ev.getY(activePointerIndex); int deltaY = mLastMotionY - y; if (dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { - deltaY -= mScrollConsumed[1] + mScrollOffset[1]; + deltaY -= mScrollConsumed[1]; vtev.offsetLocation(0, mScrollOffset[1]); } if (!mIsBeingDragged && Math.abs(deltaY) > mTouchSlop) { @@ -645,7 +645,7 @@ public class ScrollView extends FrameLayout { } if (mIsBeingDragged) { // Scroll to follow the motion event - mLastMotionY = y; + mLastMotionY = y - mScrollOffset[1]; final int oldY = mScrollY; final int range = getScrollRange(); |