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

Commit 3af714f0 authored by Tony Wickham's avatar Tony Wickham
Browse files

Remove overscroll on running task when it's not attached to RecentsView

This allows the running task to follow the finger freely until motion
pause is detected (or when trying to quick switch in a direciton that
has no tasks, as RecentsView is still attached until you swipe up).

Bug: 149934536
Change-Id: If68166e962af9f28c56017838f720e15ddb96560
parent ffc06198
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -488,6 +488,16 @@ public abstract class BaseSwipeUpHandlerV2<T extends StatefulActivity<?>, Q exte
            recentsAttachedToAppWindow = mIsShelfPeeking || mIsLikelyToStartNewTask;
        }
        mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate);

        // Reapply window transform throughout the attach animation, as the animation affects how
        // much the window is bound by overscroll (vs moving freely).
        if (animate) {
            ValueAnimator reapplyWindowTransformAnim = ValueAnimator.ofFloat(0, 1);
            reapplyWindowTransformAnim.addUpdateListener(anim -> applyWindowTransform());
            reapplyWindowTransformAnim.setDuration(RECENTS_ATTACH_DURATION).start();
        } else {
            applyWindowTransform();
        }
    }

    @Override
+8 −1
Original line number Diff line number Diff line
@@ -2290,7 +2290,14 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        if (pageIndex == -1) {
            return 0;
        }
        return getScrollForPage(pageIndex) - mOrientationHandler.getPrimaryScroll(this);
        // Unbound the scroll (due to overscroll) if the adjacent tasks are offset away from it.
        // This allows the page to move freely, given there's no visual indication why it shouldn't.
        int boundedScroll = mOrientationHandler.getPrimaryScroll(this);
        int unboundedScroll = getUnboundedScroll();
        float unboundedProgress = mAdjacentPageOffset;
        int scroll = Math.round(unboundedScroll * unboundedProgress
                + boundedScroll * (1 - unboundedProgress));
        return getScrollForPage(pageIndex) - scroll;
    }

    public Consumer<MotionEvent> getEventDispatcher(float navbarRotation) {