Merge "Explicitly set animation and timings for split cancel button" into 24D1-dev

This commit is contained in:
Treehugger Robot
2024-04-06 07:30:28 +00:00
committed by Android (Google) Code Review

View File

@@ -16,10 +16,12 @@
package com.android.quickstep.views;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.content.Context;
import android.util.AttributeSet;
import android.util.FloatProperty;
@@ -33,12 +35,14 @@ import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;
import com.android.app.animation.Interpolators;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.BaseState;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.quickstep.util.SplitSelectStateController;
/**
@@ -51,6 +55,7 @@ import com.android.quickstep.util.SplitSelectStateController;
public class SplitInstructionsView extends LinearLayout {
private static final int BOUNCE_DURATION = 250;
private static final float BOUNCE_HEIGHT = 20;
private static final int DURATION_DEFAULT_SPLIT_DISMISS = 350;
private final StatefulActivity mLauncher;
public boolean mIsCurrentlyAnimating = false;
@@ -137,9 +142,24 @@ public class SplitInstructionsView extends LinearLayout {
SplitSelectStateController splitSelectController =
((RecentsView) mLauncher.getOverviewPanel()).getSplitSelectController();
splitSelectController.getSplitAnimationController().playPlaceholderDismissAnim(mLauncher,
LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON);
mLauncher.getStateManager().goToState(LauncherState.NORMAL);
StateManager stateManager = mLauncher.getStateManager();
BaseState startState = stateManager.getState();
long duration = startState.getTransitionDuration(mLauncher, false);
if (duration == 0) {
// Case where we're in contextual on workspace (NORMAL), which by default has 0
// transition duration
duration = DURATION_DEFAULT_SPLIT_DISMISS;
}
StateAnimationConfig config = new StateAnimationConfig();
config.duration = duration;
AnimatorSet stateAnim = stateManager.createAtomicAnimation(
startState, NORMAL, config);
AnimatorSet dismissAnim = splitSelectController.getSplitAnimationController()
.createPlaceholderDismissAnim(mLauncher,
LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON, duration);
stateAnim.play(dismissAnim);
stateManager.setCurrentAnimation(stateAnim, NORMAL);
stateAnim.start();
}
void ensureProperRotation() {