From ae4e31d3ae3400acc088e4ade46c46dbddfbb981 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 4 May 2021 22:02:38 -0700 Subject: [PATCH] Fix a couple of issues with quick switch from home to empty recents - Add SKIP_SCRIM for mNonOverviewAnim, as the scrim is already handled by mXOverviewAnim (this prevents some flickering). - If RecentsView is empty, fade it in. This is less jarring than the "No recent items" appearing immediately without animation, and ensures it fades out seamlessly if you return home instead. Test: Quick switch from home with no tasks and 1 task Bug: 174228745 Change-Id: I57edc0cea4d1dfa40f87f7ccc5aa3d6b8929a1ff --- .../NoButtonQuickSwitchTouchController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 12de4a67f1..8278a5a660 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -36,11 +36,13 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_F import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import static com.android.launcher3.states.StateAnimationConfig.SKIP_ALL_ANIMATIONS; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; +import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM; import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT; import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP; import static com.android.launcher3.util.DisplayController.getSingleFrameMs; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; +import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; @@ -207,7 +209,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, /** Create state animation to control non-overview components. */ private void updateNonOverviewAnim(LauncherState toState, StateAnimationConfig config) { config.duration = (long) (Math.max(mXRange, mYRange) * 2); - config.animFlags |= SKIP_OVERVIEW; + config.animFlags |= SKIP_OVERVIEW | SKIP_SCRIM; mNonOverviewAnim = mLauncher.getStateManager() .createAnimationToNewWorkspace(toState, config); mNonOverviewAnim.getTarget().addListener(mClearStateOnCancelListener); @@ -229,10 +231,14 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // As we drag right, animate the following properties: // - RecentsView translationX // - OverviewScrim + // - RecentsView fade (if it's empty) PendingAnimation xAnim = new PendingAnimation((long) (mXRange * 2)); xAnim.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], LINEAR); xAnim.setViewBackgroundColor(mLauncher.getScrimView(), toState.getWorkspaceScrimColor(mLauncher), LINEAR); + if (mRecentsView.getTaskViewCount() == 0) { + xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR); + } mXOverviewAnim = xAnim.createPlaybackController(); mXOverviewAnim.dispatchOnStart();