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

Commit 61d639d7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make LauncherState transitionDuration overridable at runtime" into ub-launcher3-master

parents 8b65dbc9 c7203ad5
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
 */
package com.android.launcher3.uioverrides.states;

import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
@@ -39,7 +37,7 @@ public class BackgroundAppState extends OverviewState {
    }

    protected BackgroundAppState(int id, int logContainer) {
        super(id, logContainer, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
        super(id, logContainer, STATE_FLAGS);
    }

    @Override
+14 −7
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package com.android.launcher3.uioverrides.states;

import static android.view.View.VISIBLE;

import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
@@ -33,6 +32,7 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;

import android.graphics.Rect;
import android.view.View;
@@ -67,15 +67,22 @@ public class OverviewState extends LauncherState {
            | FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;

    public OverviewState(int id) {
        this(id, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
        this(id, STATE_FLAGS);
    }

    protected OverviewState(int id, int transitionDuration, int stateFlags) {
        this(id, ContainerType.TASKSWITCHER, transitionDuration, stateFlags);
    protected OverviewState(int id, int stateFlags) {
        this(id, ContainerType.TASKSWITCHER, stateFlags);
    }

    protected OverviewState(int id, int logContainer, int transitionDuration, int stateFlags) {
        super(id, logContainer, transitionDuration, stateFlags);
    protected OverviewState(int id, int logContainer, int stateFlags) {
        super(id, logContainer, stateFlags);
    }

    @Override
    public int getTransitionDuration(Launcher launcher) {
        // In no-button mode, overview comes in all the way from the left, so give it more time.
        boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(launcher).getMode() == NO_BUTTON;
        return isNoButtonMode && ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250;
    }

    @Override
@@ -206,7 +213,7 @@ public class OverviewState extends LauncherState {
    public void prepareForAtomicAnimation(Launcher launcher, LauncherState fromState,
            AnimatorSetBuilder builder) {
        if ((fromState == NORMAL || fromState == HINT_STATE) && this == OVERVIEW) {
            if (SysUINavigationMode.getMode(launcher) == SysUINavigationMode.Mode.NO_BUTTON) {
            if (SysUINavigationMode.getMode(launcher) == NO_BUTTON) {
                builder.setInterpolator(ANIM_WORKSPACE_SCALE,
                        fromState == NORMAL ? ACCEL : OVERSHOOT_1_2);
                builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
+2 −2
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo
            // Normally we compute the duration based on the velocity and distance to the given
            // state, but since the hint state tracks the entire screen without a clear endpoint, we
            // need to manually set the duration to a reasonable value.
            animator.setDuration(HINT_STATE.transitionDuration);
            animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher));
        }
    }

@@ -173,7 +173,7 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo
                // StaggeredWorkspaceAnim doesn't animate overview, so we handle it here.
                stateManager.cancelAnimation();
                AnimatorSetBuilder builder = new AnimatorSetBuilder();
                long duration = OVERVIEW.transitionDuration;
                long duration = OVERVIEW.getTransitionDuration(mLauncher);
                AnimatorSet anim = stateManager.createAtomicAnimation(
                        stateManager.getState(), NORMAL, builder,
                        ATOMIC_OVERVIEW_PEEK_COMPONENT, duration);
+6 −2
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.launcher3.uioverrides.states;

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

import com.android.launcher3.AbstractFloatingView;
@@ -40,7 +39,12 @@ public class AllAppsState extends LauncherState {
    };

    public AllAppsState(int id) {
        super(id, ContainerType.ALLAPPS, ALL_APPS_TRANSITION_MS, STATE_FLAGS);
        super(id, ContainerType.ALLAPPS, STATE_FLAGS);
    }

    @Override
    public int getTransitionDuration(Launcher launcher) {
        return 320;
    }

    @Override
+0 −6
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.launcher3;

import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;

import android.graphics.drawable.Drawable;
import android.util.FloatProperty;
import android.util.Property;
@@ -29,11 +27,7 @@ public class LauncherAnimUtils {
     * Durations for various state animations. These are not defined in resources to allow
     * easier access from static classes and enums
     */
    public static final int ALL_APPS_TRANSITION_MS = 320;
    public static final int OVERVIEW_TRANSITION_MS = ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250;
    public static final int SPRING_LOADED_TRANSITION_MS = 150;
    public static final int SPRING_LOADED_EXIT_DELAY = 500;
    public static final int HINT_TRANSITION_MS = 80;

    // The progress of an animation to all apps must be at least this far along to snap to all apps.
    public static final float MIN_PROGRESS_TO_ALL_APPS = 0.5f;
Loading