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

Commit aab726c5 authored by Adam Powell's avatar Adam Powell
Browse files

Fix consistency in nested pre-scroll with ScrollView for AbsListView

Keep sign consistency for nested pre-scroll dispatch in AbsListView
with ScrollView. Also correctly invoke nested flings.

Bug 16015770

Change-Id: Ia8a82667ea548aafda66f04e32046c3b0a5c2314
parent 6349a33d
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -3326,8 +3326,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        if (mLastY == Integer.MIN_VALUE) {
            rawDeltaY -= mMotionCorrection;
        }
        if (dispatchNestedPreScroll(0, rawDeltaY, mScrollConsumed, mScrollOffset)) {
            rawDeltaY -= mScrollConsumed[1];
        if (dispatchNestedPreScroll(0, -rawDeltaY, mScrollConsumed, mScrollOffset)) {
            rawDeltaY += mScrollConsumed[1];
            scrollOffsetCorrection -= mScrollOffset[1];
            scrollConsumedCorrection -= mScrollConsumed[1];
            if (vtev != null) {
@@ -3853,7 +3853,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                    // Since we can potentially overfling more than we can overscroll, don't
                    // allow the weird behavior where you can scroll to a boundary then
                    // fling further.
                    if (Math.abs(initialVelocity) > mMinimumVelocity &&
                    boolean flingVelocity = Math.abs(initialVelocity) > mMinimumVelocity;
                    if (flingVelocity &&
                            !((mFirstPosition == 0 &&
                                    firstChildTop == contentTop - mOverscrollDistance) ||
                              (mFirstPosition + childCount == mItemCount &&
@@ -3864,6 +3865,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                        reportScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);

                        mFlingRunnable.start(-initialVelocity);
                        dispatchNestedFling(0, -initialVelocity, true);
                    } else {
                        mTouchMode = TOUCH_MODE_REST;
                        reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
@@ -3873,6 +3875,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                        if (mPositionScroller != null) {
                            mPositionScroller.stop();
                        }
                        if (flingVelocity) {
                            dispatchNestedFling(0, -initialVelocity, false);
                        }
                    }
                }
            } else {