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

Commit 154b1c92 authored by Tony Wickham's avatar Tony Wickham
Browse files

Cleanup/consolidate normal<->all apps interpolators

We no longer need to have a different behavior for no button mode,
so make PortraitStatesTouchController the source of truth

Also remove unused ANIM_ALL_APPS_HEADER_FADE & RECENTS_FADE_THRESHOLD

Test: manually in 0 button and 3 button modes
Bug: 183001675
Bug: 175137718
Change-Id: If0bc2a6d6d3bf1649fad45226a4e6055f30e4880
parent b55372ce
Loading
Loading
Loading
Loading
+0 −45
Original line number Diff line number Diff line
@@ -18,20 +18,11 @@ package com.android.launcher3.uioverrides.touchcontrollers;

import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_HEADER_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;

@@ -45,7 +36,6 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.VibratorWrapper;
import com.android.quickstep.SystemUiProxy;
@@ -269,39 +259,4 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
    private float dpiFromPx(float pixels) {
        return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics().densityDpi);
    }

    @Override
    protected StateAnimationConfig getConfigForStates(
            LauncherState fromState, LauncherState toState) {
        if (fromState == NORMAL && toState == ALL_APPS) {
            StateAnimationConfig builder = new StateAnimationConfig();
            builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
                    ACCEL,
                    0,
                    ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
            builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
                    ACCEL,
                    ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD,
                    ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));

            // Get workspace out of the way quickly, to prepare for potential pause.
            builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3);
            builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, DEACCEL_3);
            builder.setInterpolator(ANIM_WORKSPACE_FADE, DEACCEL_3);
            return builder;
        } else if (fromState == ALL_APPS && toState == NORMAL) {
            StateAnimationConfig builder = new StateAnimationConfig();

            builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
                    DEACCEL,
                    1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
                    1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
            builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
                    DEACCEL,
                    1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
                    1));
            return builder;
        }
        return super.getConfigForStates(fromState, toState);
    }
}
+0 −6
Original line number Diff line number Diff line
@@ -58,12 +58,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
     */
    protected static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.4f;


    /**
     * The progress at which recents will begin fading out when swiping up from overview.
     */
    private static final float RECENTS_FADE_THRESHOLD = 0.88f;

    private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper;

    public PortraitStatesTouchController(Launcher l) {
+4 −6
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ public class StateAnimationConfig {
            ANIM_OVERVIEW_FADE,
            ANIM_ALL_APPS_FADE,
            ANIM_WORKSPACE_SCRIM_FADE,
            ANIM_ALL_APPS_HEADER_FADE,
            ANIM_OVERVIEW_MODAL,
            ANIM_DEPTH,
            ANIM_OVERVIEW_ACTIONS_FADE,
@@ -78,12 +77,11 @@ public class StateAnimationConfig {
    public static final int ANIM_OVERVIEW_FADE = 9;
    public static final int ANIM_ALL_APPS_FADE = 10;
    public static final int ANIM_WORKSPACE_SCRIM_FADE = 11;
    public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
    public static final int ANIM_OVERVIEW_MODAL = 13;
    public static final int ANIM_DEPTH = 14;
    public static final int ANIM_OVERVIEW_ACTIONS_FADE = 15;
    public static final int ANIM_OVERVIEW_MODAL = 12;
    public static final int ANIM_DEPTH = 13;
    public static final int ANIM_OVERVIEW_ACTIONS_FADE = 14;

    private static final int ANIM_TYPES_COUNT = 16;
    private static final int ANIM_TYPES_COUNT = 15;

    protected final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT];