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

Commit b5f473ed authored by George Mount's avatar George Mount
Browse files

VelocityTracker should not be cleared until pointer up

Fixes: 266736911

VelocityTracker was being cleared when it hit the end
of the View, but stretch overscroll can be flung.

Test: ScrollViewTest

Change-Id: Iadeca98360dc5a5462bcefbdd266bca92c0b6d5a
parent 011d00e1
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -845,11 +845,7 @@ public class ScrollView extends FrameLayout {

                    // Calling overScrollBy will call onOverScrolled, which
                    // calls onScrollChanged if applicable.
                    if (overScrollBy(0, deltaY, 0, mScrollY, 0, range, 0, mOverscrollDistance, true)
                            && !hasNestedScrollingParent()) {
                        // Break our velocity if we hit a scroll barrier.
                        mVelocityTracker.clear();
                    }
                    overScrollBy(0, deltaY, 0, mScrollY, 0, range, 0, mOverscrollDistance, true);

                    final int scrolledDeltaY = mScrollY - oldY;
                    final int unconsumedY = deltaY - scrolledDeltaY;
@@ -894,6 +890,7 @@ public class ScrollView extends FrameLayout {

                    mActivePointerId = INVALID_POINTER;
                    endDrag();
                    velocityTracker.clear();
                }
                break;
            case MotionEvent.ACTION_CANCEL: