From 0525e3a4620b06ed7c2a3cf0ddf91a4dc7aa5b8d Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Mon, 3 Oct 2022 17:55:11 -0700 Subject: [PATCH] Add transitions to DWB banner when app thumbnail progresses from Overview tile to fullscreen This patch makes it so that the DWB banner transitions out neatly when a user in Overview drags a tile downward to launch the app. Previously, the banner would stick around throughout the transition, creating visual clutter and drawing attention to the corners of the app. Fixed by creating an exit transition in setFullscreenProgress(), similar to other UI elements like Overview action chips. There is another outstanding issue where sometimes the transition can get clipped and jump to the final frame. The cause is still unknown, but issue is tracked at b/250976138 for a future fix. Fixes: 249825524 Test: Manual Change-Id: Iea47a9bc643537f0b716ce11b104803d9ca25fd2 --- .../quickstep/views/DesktopTaskView.java | 2 +- .../quickstep/views/GroupedTaskView.java | 4 ++-- .../com/android/quickstep/views/TaskView.java | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java index 9874f9644a..485b915de0 100644 --- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java +++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java @@ -434,7 +434,7 @@ public class DesktopTaskView extends TaskView { } @Override - protected void setIconAndDimTransitionProgress(float progress, boolean invert) { + protected void setIconsAndBannersTransitionProgress(float progress, boolean invert) { // no-op } diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index 71b0c60971..2f8b130dc0 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -319,8 +319,8 @@ public class GroupedTaskView extends TaskView { } @Override - protected void setIconAndDimTransitionProgress(float progress, boolean invert) { - super.setIconAndDimTransitionProgress(progress, invert); + protected void setIconsAndBannersTransitionProgress(float progress, boolean invert) { + super.setIconsAndBannersTransitionProgress(progress, invert); // Value set by super call float scale = mIconView.getAlpha(); mIconView2.setAlpha(scale); diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 35f0f5d1df..cd6fa7a181 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -19,6 +19,7 @@ package com.android.quickstep.views; import static android.view.Display.DEFAULT_DISPLAY; import static android.widget.Toast.LENGTH_SHORT; +import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.Utilities.comp; import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; @@ -171,7 +172,7 @@ public class TaskView extends FrameLayout implements Reusable { new FloatProperty("focusTransition") { @Override public void setValue(TaskView taskView, float v) { - taskView.setIconAndDimTransitionProgress(v, false /* invert */); + taskView.setIconsAndBannersTransitionProgress(v, false /* invert */); } @Override @@ -953,7 +954,11 @@ public class TaskView extends FrameLayout implements Reusable { return deviceProfile.isTablet && !isFocusedTask(); } - protected void setIconAndDimTransitionProgress(float progress, boolean invert) { + /** + * Called to animate a smooth transition when going directly from an app into Overview (and + * vice versa). Icons fade in, and DWB banners slide in with a "shift up" animation. + */ + protected void setIconsAndBannersTransitionProgress(float progress, boolean invert) { if (invert) { progress = 1 - progress; } @@ -997,7 +1002,7 @@ public class TaskView extends FrameLayout implements Reusable { if (mIconAndDimAnimator != null) { mIconAndDimAnimator.cancel(); } - setIconAndDimTransitionProgress(iconScale, invert); + setIconsAndBannersTransitionProgress(iconScale, invert); } protected void resetPersistentViewTransforms() { @@ -1417,6 +1422,12 @@ public class TaskView extends FrameLayout implements Reusable { mIconView.setVisibility(progress < 1 ? VISIBLE : INVISIBLE); mSnapshotView.getTaskOverlay().setFullscreenProgress(progress); + // Animate icons and DWB banners in/out, except in QuickSwitch state, when tiles are + // oversized and banner would look disproportionately large. + if (mActivity.getStateManager().getState() != BACKGROUND_APP) { + setIconsAndBannersTransitionProgress(progress, true); + } + updateSnapshotRadius(); }