Merge "desktop-exploded-view: Explode desktops when swiping up from home" into main

This commit is contained in:
Daniel Andersson
2025-02-21 09:50:39 -08:00
committed by Android (Google) Code Review
5 changed files with 50 additions and 10 deletions
@@ -20,6 +20,7 @@ import com.android.app.animation.Interpolators.AGGRESSIVE_EASE_IN_OUT
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_PRIMARY_SPLIT_TRANSLATION
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 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) :
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 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) :
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,
@@ -18,6 +18,7 @@ package com.android.quickstep.fallback;
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_PRIMARY_SPLIT_TRANSLA
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 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
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()),
@@ -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.enableDesktopExplodedView
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 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
?.inflate()
}
fun startWindowExplodeAnimation(): Animator =
AnimatedFloat { progress -> explodeProgress = progress }.animateToValue(0.0f, 1.0f)
private fun positionTaskWindows() {
if (taskContainers.isEmpty()) {
return
@@ -73,6 +73,7 @@ import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_RO
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;
@@ -2911,13 +2912,15 @@ public abstract class RecentsView<
}
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);
}
}
@@ -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 @@ class RecentsViewUtils(private val recentsView: RecentsView<*, *>) {
}
}
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()
}
}