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
This commit is contained in:
Tony Wickham
2020-08-05 13:32:37 -07:00
parent ffc06198ff
commit 3af714f052
2 changed files with 18 additions and 1 deletions

View File

@@ -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

View File

@@ -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) {