Reset RecentsView#mNextPage when swiping to home

This ensures that we don't inadvertently update mCurrentPage to be
mNextPage in computeScrollHelper(), which would in turn mess up
calculations such as RecentsView#getHorizontalOffsetSize().

Also removed resetNextPage parameter from forceFinishScroller(), as
resetNextPage was always passed as true anyway.

Test: Swipe up and to the right to home, ensure adjacent page goes all
the way off screen
Fixes: 199927699

Change-Id: Iee1ffac10e5195f0c3a124a23b06d5411ecd7ba2
This commit is contained in:
Tony Wickham
2021-09-14 14:26:50 -07:00
parent ca549695aa
commit d552132d0b
3 changed files with 10 additions and 8 deletions

View File

@@ -254,7 +254,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
mOrientationHandler.set(this, VIEW_SCROLL_TO, newPosition);
mScroller.startScroll(mScroller.getCurrX(), 0, newPosition - mScroller.getCurrX(), 0);
forceFinishScroller(true);
forceFinishScroller();
}
/**
@@ -276,14 +276,16 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
}
private void forceFinishScroller(boolean resetNextPage) {
/**
* Immediately finishes any in-progress scroll, maintaining the current position. Also sets
* mNextPage = INVALID_PAGE and calls pageEndTransition().
*/
public void forceFinishScroller() {
mScroller.forceFinished(true);
// We need to clean up the next page here to avoid computeScrollHelper from
// updating current page on the pass.
if (resetNextPage) {
mNextPage = INVALID_PAGE;
pageEndTransition();
}
mNextPage = INVALID_PAGE;
pageEndTransition();
}
private int validateNewPage(int newPage) {