desktop-exploded-view: Explode desktops when swiping up from home
This change makes it so that the explode animation only happens when
swiping up from the desk. In other cases, the desk is immediately set
to its exploded state.
The desk explode progress is now exposed as a FloatProperty in
RecentsViewUtils.
Flag: com.android.launcher3.enable_desktop_exploded_view
Test: Manual
Bug: 367353392
Change-Id: I5adec7db1fdc933860dce7fcca0a47cec0672ee7
diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt
index c8f46a9..cca8bf8 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt
+++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt
@@ -20,6 +20,7 @@
import com.android.app.animation.Interpolators.FINAL_FRAME
import com.android.app.animation.Interpolators.INSTANT
import com.android.app.animation.Interpolators.LINEAR
+import com.android.launcher3.Flags.enableDesktopExplodedView
import com.android.launcher3.Flags.enableLargeDesktopWindowingTile
import com.android.launcher3.LauncherState
import com.android.launcher3.anim.AnimatedFloat
@@ -51,6 +52,7 @@
import com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION
import com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION
import com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA
+import com.android.quickstep.views.RecentsViewUtils.Companion.DESK_EXPLODE_PROGRESS
import com.android.quickstep.views.TaskView.Companion.FLAG_UPDATE_ALL
/**
@@ -74,6 +76,13 @@
recentsView,
if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f,
)
+ if (enableDesktopExplodedView()) {
+ DESK_EXPLODE_PROGRESS.set(
+ recentsView,
+ if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f,
+ )
+ }
+
TASK_THUMBNAIL_SPLASH_ALPHA.set(
recentsView,
if (state.showTaskThumbnailSplash()) 1f else 0f,
@@ -156,6 +165,15 @@
getOverviewInterpolator(fromState, toState),
)
+ if (enableDesktopExplodedView()) {
+ builder.setFloat(
+ recentsView,
+ DESK_EXPLODE_PROGRESS,
+ if (toState.isRecentsViewVisible) 1f else 0f,
+ getOverviewInterpolator(fromState, toState),
+ )
+ }
+
if (enableLargeDesktopWindowingTile()) {
builder.setFloat(
recentsView,
diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
index b4b80c5..56dd696 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
@@ -18,6 +18,7 @@
import static com.android.app.animation.Interpolators.FINAL_FRAME;
import static com.android.app.animation.Interpolators.INSTANT;
import static com.android.app.animation.Interpolators.LINEAR;
+import static com.android.launcher3.Flags.enableDesktopExplodedView;
import static com.android.launcher3.Flags.enableLargeDesktopWindowingTile;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
@@ -36,6 +37,7 @@
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
import static com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA;
+import static com.android.quickstep.views.RecentsViewUtils.DESK_EXPLODE_PROGRESS;
import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL;
import android.util.FloatProperty;
@@ -123,6 +125,10 @@
state.detachDesktopCarousel() ? 1f : 0f,
getOverviewInterpolator(state));
}
+ if (enableDesktopExplodedView()) {
+ setter.setFloat(mRecentsView, DESK_EXPLODE_PROGRESS, showAsGrid ? 1f : 0f,
+ getOverviewInterpolator(state));
+ }
setter.setViewBackgroundColor(mRecentsViewContainer.getScrimView(),
state.getScrimColor(mRecentsViewContainer.asContext()),
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
index fbda3b3..9bb8f3d 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
@@ -15,7 +15,6 @@
*/
package com.android.quickstep.views
-import android.animation.Animator
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Matrix
@@ -36,7 +35,6 @@
import com.android.launcher3.Flags.enableOverviewIconMenu
import com.android.launcher3.Flags.enableRefactorTaskThumbnail
import com.android.launcher3.R
-import com.android.launcher3.anim.AnimatedFloat
import com.android.launcher3.testing.TestLogging
import com.android.launcher3.testing.shared.TestProtocol
import com.android.launcher3.util.RunnableList
@@ -165,9 +163,6 @@
?.inflate()
}
- fun startWindowExplodeAnimation(): Animator =
- AnimatedFloat { progress -> explodeProgress = progress }.animateToValue(0.0f, 1.0f)
-
private fun positionTaskWindows() {
if (taskContainers.isEmpty()) {
return
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index c5a76cb..32854a7 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -72,6 +72,7 @@
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_TASKS;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SELECT_ACTIVE;
+import static com.android.quickstep.views.RecentsViewUtils.DESK_EXPLODE_PROGRESS;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -2910,13 +2911,15 @@
}
if (enableDesktopExplodedView()) {
+ if (animatorSet == null) {
+ mUtils.setDeskExplodeProgress(1);
+ } else {
+ animatorSet.play(
+ ObjectAnimator.ofFloat(this, DESK_EXPLODE_PROGRESS, 1));
+ }
+
for (TaskView taskView : getTaskViews()) {
if (taskView instanceof DesktopTaskView desktopTaskView) {
- if (animatorSet == null) {
- desktopTaskView.setExplodeProgress(1.0f);
- } else {
- animatorSet.play(desktopTaskView.startWindowExplodeAnimation());
- }
desktopTaskView.setRemoteTargetHandles(remoteTargetHandles);
}
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt b/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt
index f742ec3..8df7430 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt
+++ b/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt
@@ -17,6 +17,7 @@
package com.android.quickstep.views
import android.graphics.Rect
+import android.util.FloatProperty
import android.view.View
import androidx.core.view.children
import com.android.launcher3.Flags.enableLargeDesktopWindowingTile
@@ -294,7 +295,24 @@
}
}
+ var deskExplodeProgress: Float = 0f
+ set(value) {
+ field = value
+ taskViews.filterIsInstance<DesktopTaskView>().forEach { it.explodeProgress = field }
+ }
+
companion object {
+ @JvmField
+ val DESK_EXPLODE_PROGRESS =
+ object : FloatProperty<RecentsView<*, *>>("deskExplodeProgress") {
+ override fun setValue(recentsView: RecentsView<*, *>, value: Float) {
+ recentsView.mUtils.deskExplodeProgress = value
+ }
+
+ override fun get(recentsView: RecentsView<*, *>) =
+ recentsView.mUtils.deskExplodeProgress
+ }
+
val TEMP_RECT = Rect()
}
}