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

Commit 86874c8b authored by Adam Powell's avatar Adam Powell Committed by Android Git Automerger
Browse files

am 157fab0c: Nested pre-fling for AbsListView and ScrollView

* commit '157fab0c71afa7b4dfb44a5d6cbb2a117cbf73a3':
  Nested pre-fling for AbsListView and ScrollView
parents f1402043 9413b245
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -3857,13 +3857,17 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                                    firstChildTop == contentTop - mOverscrollDistance) ||
                              (mFirstPosition + childCount == mItemCount &&
                                    lastChildBottom == contentBottom + mOverscrollDistance))) {
                        if (!dispatchNestedPreFling(0, -initialVelocity)) {
                            if (mFlingRunnable == null) {
                                mFlingRunnable = new FlingRunnable();
                            }
                            reportScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);

                            mFlingRunnable.start(-initialVelocity);
                            dispatchNestedFling(0, -initialVelocity, true);
                        } else {
                            mTouchMode = TOUCH_MODE_REST;
                            reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
                        }
                    } else {
                        mTouchMode = TOUCH_MODE_REST;
                        reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
@@ -4029,7 +4033,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            if (mFlingRunnable == null) {
                mFlingRunnable = new FlingRunnable();
            }
            if (!dispatchNestedPreFling(0, velocityY)) {
                mFlingRunnable.start((int) velocityY);
            }
            return true;
        }
        return dispatchNestedFling(velocityX, velocityY, consumed);
+5 −3
Original line number Diff line number Diff line
@@ -1577,11 +1577,13 @@ public class ScrollView extends FrameLayout {
    private void flingWithNestedDispatch(int velocityY) {
        final boolean canFling = (mScrollY > 0 || velocityY > 0) &&
                (mScrollY < getScrollRange() || velocityY < 0);
        if (!dispatchNestedPreFling(0, velocityY)) {
            dispatchNestedFling(0, velocityY, canFling);
            if (canFling) {
                fling(velocityY);
            }
        }
    }

    private void endDrag() {
        mIsBeingDragged = false;