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

Commit d552132d authored by Tony Wickham's avatar Tony Wickham
Browse files

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
parent ca549695
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ public class StaggeredWorkspaceAnim {
        launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start();

        // Stop scrolling so that it doesn't interfere with the translation offscreen.
        launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
        launcher.<RecentsView>getOverviewPanel().forceFinishScroller();

        if (animateOverviewScrim) {
            launcher.getWorkspace().getStateTransitionAnimation()
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public class WorkspaceRevealAnim {
        launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start();

        // Stop scrolling so that it doesn't interfere with the translation offscreen.
        launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
        launcher.<RecentsView>getOverviewPanel().forceFinishScroller();

        if (animateOverviewScrim) {
            launcher.getWorkspace().getStateTransitionAnimation()
+8 −6
Original line number Diff line number Diff line
@@ -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,15 +276,17 @@ 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();
    }
    }

    private int validateNewPage(int newPage) {
        newPage = ensureWithinScrollBounds(newPage);