Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9a0d6a8 authored by Yorke Lee's avatar Yorke Lee
Browse files

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
parent ce8083fc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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();