From 8be6c7106cf9b0123f7acbeecde1446c8a6bbbf4 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 7 Jul 2021 13:43:22 +0100 Subject: [PATCH] Don't create gap between last task and clear all button - If a task is too close to ClearAllButton when being snapped to, change the snap position to barely not seeing ClearAllButton - When snapping to the above tasks from quick switch, apply a horizontal grid translation to smoothly snap into position - Apply the above grid translation to TaskViewSimulator as well Bug: 192254835 Test: manual Change-Id: I32d562a1726f7c8b41ac10c7deece890df7e1304 --- .../android/quickstep/AbsSwipeUpHandler.java | 8 +- .../fallback/FallbackRecentsView.java | 6 +- .../android/quickstep/views/RecentsView.java | 78 ++++++++++++------- 3 files changed, 56 insertions(+), 36 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 096ac6c5ca..aa4a1ca86a 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1026,9 +1026,6 @@ public abstract class AbsSwipeUpHandler, if (mRecentsView != null) { int nearestPage = mRecentsView.getDestinationPage(); boolean isScrolling = false; - // Update page scroll before snapping to page to make sure we snapped to the - // position calculated with target gesture in mind. - mRecentsView.updateScrollSynchronously(); if (mRecentsView.getNextPage() != nearestPage) { // We shouldn't really scroll to the next page when swiping up to recents. // Only allow settling on the next page if it's nearest to the center. @@ -1187,7 +1184,8 @@ public abstract class AbsSwipeUpHandler, mLauncherTransitionController = null; if (mRecentsView != null) { - mRecentsView.onPrepareGestureEndAnimation(null, mGestureState.getEndTarget()); + mRecentsView.onPrepareGestureEndAnimation(null, mGestureState.getEndTarget(), + mTaskViewSimulator); } } else { AnimatorSet animatorSet = new AnimatorSet(); @@ -1229,7 +1227,7 @@ public abstract class AbsSwipeUpHandler, animatorSet.play(windowAnim); if (mRecentsView != null) { mRecentsView.onPrepareGestureEndAnimation( - animatorSet, mGestureState.getEndTarget()); + animatorSet, mGestureState.getEndTarget(), mTaskViewSimulator); } animatorSet.setDuration(duration).setInterpolator(interpolator); animatorSet.start(); diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index d9631880dc..3bf79f1579 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -36,6 +36,7 @@ import com.android.launcher3.statemanager.StateManager.StateListener; import com.android.quickstep.FallbackActivityInterface; import com.android.quickstep.GestureState; import com.android.quickstep.RecentsActivity; +import com.android.quickstep.util.TaskViewSimulator; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.SplitPlaceholderView; @@ -89,8 +90,9 @@ public class FallbackRecentsView extends RecentsView clearAllScroll)) { + pageScroll = clearAllScroll + (mIsRtl ? clearAllWidth : -clearAllWidth); + } if (outPageScrolls[i] != pageScroll) { pageScrollChanged = true; outPageScrolls[i] = pageScroll;