Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21a5b12b authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Update animations for TM-QPR: Overview > OverviewSplitSelect transition

This change updates the Overview > OverviewSplitSelect animation to the latest spec. This is a re-upload of a previous change, ag/19464657, but no longer will cause the b/241165022 issue.

Includes:
- New timings
- Task thumbnails slide in with an "overshoot" animation
- Icons fade out and fade in appropriately
- SplitInstructionsView has a new compound "unfold" animation

Bug: 236760307
Test: Manual on tablet. Made sure the b/241165022 issue is fixed.
Change-Id: Ia22f6b6d7b9474b782e693fae2320a34a2985b18
parent 06849c4e
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.util.FloatProperty;
import android.util.Pair;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.LauncherState;
import com.android.launcher3.anim.AnimatorListeners;
@@ -71,7 +70,10 @@ public final class RecentsViewStateController extends
        // DepthController to prevent optimizations which might occlude the layers behind
        mLauncher.getDepthController().setHasContentBehindLauncher(state.overviewUi);

        handleSplitSelectionState(state, null);
        PendingAnimation builder =
                new PendingAnimation(state.getTransitionDuration(mLauncher, true));

        handleSplitSelectionState(state, builder, /* animate */false);
    }

    @Override
@@ -92,7 +94,7 @@ public final class RecentsViewStateController extends
        builder.addListener(AnimatorListeners.forSuccessCallback(() ->
                mLauncher.getDepthController().setHasContentBehindLauncher(toState.overviewUi)));

        handleSplitSelectionState(toState, builder);
        handleSplitSelectionState(toState, builder, /* animate */true);

        setAlphas(builder, config, toState);
        builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS,
@@ -105,8 +107,7 @@ public final class RecentsViewStateController extends
     *                will add animations to builder.
     */
    private void handleSplitSelectionState(@NonNull LauncherState toState,
            @Nullable PendingAnimation builder) {
        boolean animate = builder != null;
            @NonNull PendingAnimation builder, boolean animate) {
        PagedOrientationHandler orientationHandler =
                ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler();
        Pair<FloatProperty, FloatProperty> taskViewsFloat =
@@ -115,18 +116,15 @@ public final class RecentsViewStateController extends
                        mLauncher.getDeviceProfile());

        if (toState == OVERVIEW_SPLIT_SELECT) {
            // Animation to "dismiss" selected taskView
            PendingAnimation splitSelectInitAnimation = mRecentsView.createSplitSelectInitAnimation(
            mRecentsView.createSplitSelectInitAnimation(builder,
                    toState.getTransitionDuration(mLauncher, true /* isToState */));
            // Add properties to shift remaining taskViews to get out of placeholder view
            splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.first,
            builder.setFloat(mRecentsView, taskViewsFloat.first,
                    toState.getSplitSelectTranslation(mLauncher), LINEAR);
            splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR);
            builder.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR);

            if (!animate) {
                splitSelectInitAnimation.buildAnim().start();
            } else {
                builder.add(splitSelectInitAnimation.buildAnim());
                builder.buildAnim().start();
            }

            mRecentsView.applySplitPrimaryScrollOffset();
+12 −0
Original line number Diff line number Diff line
@@ -79,6 +79,14 @@ public class QuickstepAtomicAnimationFactory extends
    private static final int PER_PAGE_SCROLL_DURATION = 150;
    private static final int MAX_PAGE_SCROLL_DURATION = 750;

    private static final int OVERVIEW_TO_SPLIT_ACTIONS_FADE_START = 0;
    private static final int OVERVIEW_TO_SPLIT_ACTIONS_FADE_END = 83;

    private static final float OVERVIEW_TO_SPLIT_ACTIONS_FADE_START_OFFSET =
            (float) OVERVIEW_TO_SPLIT_ACTIONS_FADE_START / SplitScreenSelectState.ENTER_DURATION;
    private static final float OVERVIEW_TO_SPLIT_ACTIONS_FADE_END_OFFSET =
            (float) OVERVIEW_TO_SPLIT_ACTIONS_FADE_END / SplitScreenSelectState.ENTER_DURATION;

    // Due to use of physics, duration may differ between devices so we need to calculate and
    // cache the value.
    private int mHintToNormalDuration = -1;
@@ -188,6 +196,10 @@ public class QuickstepAtomicAnimationFactory extends
            AllAppsSwipeController.applyAllAppsToNormalConfig(mActivity, config);
        } else if (fromState == NORMAL && toState == ALL_APPS) {
            AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mActivity, config);
        } else if (fromState == OVERVIEW && toState == OVERVIEW_SPLIT_SELECT) {
            config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR,
                    OVERVIEW_TO_SPLIT_ACTIONS_FADE_START_OFFSET,
                    OVERVIEW_TO_SPLIT_ACTIONS_FADE_END_OFFSET));
        }
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.launcher3.uioverrides.states;

import android.content.Context;

import com.android.launcher3.Launcher;
import com.android.quickstep.views.RecentsView;

@@ -24,6 +26,10 @@ import com.android.quickstep.views.RecentsView;
 * pinned and user is selecting the second one
 */
public class SplitScreenSelectState extends OverviewState {
    public static final int ENTER_DURATION = 866;
    public static final int EXIT_DURATION = 500;
    // TODO: Add ability to differentiate between Split > Home and Split > Confirmed timings

    public SplitScreenSelectState(int id) {
        super(id);
    }
@@ -38,4 +44,9 @@ public class SplitScreenSelectState extends OverviewState {
        RecentsView recentsView = launcher.getOverviewPanel();
        return recentsView.getSplitSelectTranslation();
    }

    @Override
    public int getTransitionDuration(Context context, boolean isToState) {
        return isToState ? ENTER_DURATION : EXIT_DURATION;
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -236,7 +236,8 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
        PendingAnimation pa;
        if (goingUp) {
            currentInterpolator = Interpolators.LINEAR;
            pa = mRecentsView.createTaskDismissAnimation(mTaskBeingDragged,
            pa = new PendingAnimation(maxDuration);
            mRecentsView.createTaskDismissAnimation(pa, mTaskBeingDragged,
                    true /* animateTaskView */, true /* removeTask */, maxDuration,
                    false /* dismissingForSplitSelection*/);

+5 −2
Original line number Diff line number Diff line
@@ -114,8 +114,11 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState

        RecentsState currentState = mActivity.getStateManager().getState();
        if (isSplitSelectionState(state) && !isSplitSelectionState(currentState)) {
            setter.add(mRecentsView.createSplitSelectInitAnimation(
                    state.getTransitionDuration(mActivity, true /* isToState */)).buildAnim());
            int duration = state.getTransitionDuration(mActivity, true /* isToState */);
            // TODO (b/246851887): Pass in setter as a NO_ANIM PendingAnimation instead
            PendingAnimation pa = new PendingAnimation(duration);
            mRecentsView.createSplitSelectInitAnimation(pa, duration);
            setter.add(pa.buildAnim());
        }

        Pair<FloatProperty, FloatProperty> taskViewsFloat =
Loading