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

Commit eb6a592a authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix issues with ListView.smoothScrollBy"

parents 2e2096fc 029cfbd6
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -2849,8 +2849,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                final int lastViewHeight = lastView.getHeight();
                final int lastViewTop = lastView.getTop();
                final int lastViewPixelsShowing = listHeight - lastViewTop;
                final int extraScroll = lastPos < mItemCount - 1 ? mExtraScroll : mListPadding.bottom;

                smoothScrollBy(lastViewHeight - lastViewPixelsShowing + mExtraScroll,
                smoothScrollBy(lastViewHeight - lastViewPixelsShowing + extraScroll,
                        mScrollDuration);

                mLastSeenPos = lastPos;
@@ -2862,7 +2863,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                
            case MOVE_DOWN_BOUND: {
                final int nextViewIndex = 1;
                if (firstPos == mBoundPos || getChildCount() <= nextViewIndex) {
                final int childCount = getChildCount();
                
                if (firstPos == mBoundPos || childCount <= nextViewIndex
                        || firstPos + childCount >= mItemCount) {
                    return;
                }
                final int nextPos = firstPos + nextViewIndex;
@@ -2904,8 +2908,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                    return;
                }
                final int firstViewTop = firstView.getTop();
                final int extraScroll = firstPos > 0 ? mExtraScroll : mListPadding.top;

                smoothScrollBy(firstViewTop - mExtraScroll, mScrollDuration);
                smoothScrollBy(firstViewTop - extraScroll, mScrollDuration);

                mLastSeenPos = firstPos;

@@ -3075,7 +3080,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te

        final boolean down = incrementalDeltaY < 0;

        final boolean inTouchMode = isInTouchMode();
        if (inTouchMode) {
            hideSelector();
        }

        final int headerViewsCount = getHeaderViewsCount();
        final int footerViewsStart = mItemCount - getFooterViewsCount();
@@ -3146,6 +3154,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            fillGap(down);
        }

        if (!inTouchMode && mSelectedPosition != INVALID_POSITION) {
            positionSelector(getChildAt(mSelectedPosition - mFirstPosition));
        }

        mBlockLayoutRequests = false;

        invokeOnItemScrollListener();