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

Commit a4ba5167 authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Update animations for TM-QPR: OverviewSplitSelect > Confirmed transition

This change updates the animation for confirming a split.

Includes:
- New timings
- A new interface, SplitAnimationTimings, that centralizes timing values for splitscreen animations

Fixes: 241126570
Test: Manual
Change-Id: I61339964a7254618b368b17f00fda8f5efb53de4
parent ade8b9d7
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.launcher3.touch.AllAppsSwipeController;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.util.RecentsAtomicAnimationFactory;
import com.android.quickstep.util.SplitAnimationTimings;
import com.android.quickstep.views.RecentsView;

/**
@@ -79,14 +80,6 @@ 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;
@@ -197,9 +190,10 @@ public class QuickstepAtomicAnimationFactory extends
        } else if (fromState == NORMAL && toState == ALL_APPS) {
            AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mActivity, config);
        } else if (fromState == OVERVIEW && toState == OVERVIEW_SPLIT_SELECT) {
            SplitAnimationTimings timings = SplitAnimationTimings.OVERVIEW_TO_SPLIT;
            config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR,
                    OVERVIEW_TO_SPLIT_ACTIONS_FADE_START_OFFSET,
                    OVERVIEW_TO_SPLIT_ACTIONS_FADE_END_OFFSET));
                    timings.getActionsFadeStartOffset(),
                    timings.getActionsFadeEndOffset()));
        }
    }
}
+4 −5
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3.uioverrides.states;
import android.content.Context;

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

/**
@@ -26,10 +27,6 @@ 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);
    }
@@ -47,6 +44,8 @@ public class SplitScreenSelectState extends OverviewState {

    @Override
    public int getTransitionDuration(Context context, boolean isToState) {
        return isToState ? ENTER_DURATION : EXIT_DURATION;
        return isToState
                ? SplitAnimationTimings.ENTER_DURATION
                : SplitAnimationTimings.ABORT_DURATION;
    }
}
+89 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.quickstep.util;

import static com.android.launcher3.anim.Interpolators.DEACCEL_2;

import android.view.animation.Interpolator;

/**
 * Timings for the Overview > OverviewSplitSelect animation.
 */
public class OverviewToSplitTimings implements SplitAnimationTimings {
    public int getThumbnailFadeToGrayStart() { return 0; }
    public int getThumbnailFadeToGrayEnd() { return 133; }
    public int getDockedIconFadeInStart() { return 167; }
    public int getDockedIconFadeInEnd() { return 250; }
    public int getStagedRectSlideStart() { return 0; }
    public int getStagedRectSlideEnd() { return 417; }
    public int getGridSlideStart() { return 67; }
    public int getGridSlideStagger() { return 16; }
    public int getGridSlideDuration() { return 500; }
    public int getActionsFadeStart() { return 0; }
    public int getActionsFadeEnd() { return 83; }
    public int getIconFadeStart() { return 0; }
    public int getIconFadeEnd() { return 83; }
    public int getInstructionsContainerFadeInStart() { return 167; }
    public int getInstructionsContainerFadeInEnd() { return 250; }
    public int getInstructionsTextFadeInStart() { return 217; }
    public int getInstructionsTextFadeInEnd() { return 300; }
    public int getInstructionsUnfoldStart() { return 167; }
    public int getInstructionsUnfoldEnd() { return 500; }

    public int getDuration() { return ENTER_DURATION; }
    public Interpolator getStagedRectSlideInterpolator() { return DEACCEL_2; }

    public float getGridSlideStartOffset() {
        return (float) getGridSlideStart() / getDuration();
    }
    public float getGridSlideStaggerOffset() {
        return (float) getGridSlideStagger() / getDuration();
    }
    public float getGridSlideDurationOffset() {
        return (float) getGridSlideDuration() / getDuration();
    }
    public float getActionsFadeStartOffset() {
        return (float) getActionsFadeStart() / getDuration();
    }
    public float getActionsFadeEndOffset() {
        return (float) getActionsFadeEnd() / getDuration();
    }
    public float getIconFadeStartOffset() {
        return (float) getIconFadeStart() / getDuration();
    }
    public float getIconFadeEndOffset() {
        return (float) getIconFadeEnd() / getDuration();
    }
    public float getInstructionsContainerFadeInStartOffset() {
        return (float) getInstructionsContainerFadeInStart() / getDuration();
    }
    public float getInstructionsContainerFadeInEndOffset() {
        return (float) getInstructionsContainerFadeInEnd() / getDuration();
    }
    public float getInstructionsTextFadeInStartOffset() {
        return (float) getInstructionsTextFadeInStart() / getDuration();
    }
    public float getInstructionsTextFadeInEndOffset() {
        return (float) getInstructionsTextFadeInEnd() / getDuration();
    }
    public float getInstructionsUnfoldStartOffset() {
        return (float) getInstructionsUnfoldStart() / getDuration();
    }
    public float getInstructionsUnfoldEndOffset() {
        return (float) getInstructionsUnfoldEnd() / getDuration();
    }
}
+79 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.quickstep.util;

import android.view.animation.Interpolator;

/**
 * An interface that supports the centralization of timing information for splitscreen animations.
 */
public interface SplitAnimationTimings {
    int ENTER_DURATION = 866;
    int ABORT_DURATION = 500;
    int CONFIRM_DURATION = 383;

    SplitAnimationTimings OVERVIEW_TO_SPLIT = new OverviewToSplitTimings();
    SplitAnimationTimings SPLIT_TO_CONFIRM = new SplitToConfirmTimings();

    // Shared methods
    int getDuration();
    int getThumbnailFadeToGrayStart();
    int getThumbnailFadeToGrayEnd();
    int getDockedIconFadeInStart();
    int getDockedIconFadeInEnd();
    int getStagedRectSlideStart();
    int getStagedRectSlideEnd();
    Interpolator getStagedRectSlideInterpolator();
    default float getThumbnailFadeToGrayStartOffset() {
        return (float) getThumbnailFadeToGrayStart() / getDuration();
    }
    default float getThumbnailFadeToGrayEndOffset() {
        return (float) getThumbnailFadeToGrayEnd() / getDuration();
    }
    default float getDockedIconFadeInStartOffset() {
        return (float) getDockedIconFadeInStart() / getDuration();
    }
    default float getDockedIconFadeInEndOffset() {
        return (float) getDockedIconFadeInEnd() / getDuration();
    }
    default float getStagedRectSlideStartOffset() {
        return (float) getStagedRectSlideStart() / getDuration();
    }
    default float getStagedRectSlideEndOffset() {
        return (float) getStagedRectSlideEnd() / getDuration();
    }

    // Defaults for OverviewToSplit
    default float getGridSlideStartOffset() { return 0; }
    default float getGridSlideStaggerOffset() { return 0; }
    default float getGridSlideDurationOffset() { return 0; }
    default float getActionsFadeStartOffset() { return 0; }
    default float getActionsFadeEndOffset() { return 0; }
    default float getIconFadeStartOffset() { return 0; }
    default float getIconFadeEndOffset() { return 0; }
    default float getInstructionsContainerFadeInStartOffset() { return 0; }
    default float getInstructionsContainerFadeInEndOffset() { return 0; }
    default float getInstructionsTextFadeInStartOffset() { return 0; }
    default float getInstructionsTextFadeInEndOffset() { return 0; }
    default float getInstructionsUnfoldStartOffset() { return 0; }
    default float getInstructionsUnfoldEndOffset() { return 0; }

    // Defaults for SplitToConfirm
    default float getInstructionsFadeStartOffset() { return 0; }
    default float getInstructionsFadeEndOffset() { return 0; }
}
+45 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.quickstep.util;

import static com.android.launcher3.anim.Interpolators.LINEAR;

import android.view.animation.Interpolator;

/**
 * Timings for the OverviewSplitSelect > confirmed animation.
 */
public class SplitToConfirmTimings implements SplitAnimationTimings {
    public int getThumbnailFadeToGrayStart() { return 0; }
    public int getThumbnailFadeToGrayEnd() { return 133; }
    public int getDockedIconFadeInStart() { return 167; }
    public int getDockedIconFadeInEnd() { return 250; }
    public int getStagedRectSlideStart() { return 0; }
    public int getStagedRectSlideEnd() { return 383; }
    public int getInstructionsFadeStart() { return 0; }
    public int getInstructionsFadeEnd() { return 67; }

    public int getDuration() { return CONFIRM_DURATION; }
    public Interpolator getStagedRectSlideInterpolator() { return LINEAR; }

    public float getInstructionsFadeStartOffset() {
        return (float) getInstructionsFadeStart() / getDuration();
    }
    public float getInstructionsFadeEndOffset() {
        return (float) getInstructionsFadeEnd() / getDuration();
    }
}
Loading