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

Commit 30ffc3f9 authored by Samuel Fufa's avatar Samuel Fufa Committed by Android (Google) Code Review
Browse files

Merge changes Ice83b544,If0bc2a6d into sc-dev

* changes:
  [Search][Motion] Modify interpolator for AllApps background scrim
  Cleanup/consolidate normal<->all apps interpolators
parents cc65b07d 3ab273da
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);
    }
}
+18 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;

import android.view.MotionEvent;

@@ -56,13 +57,17 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
    /**
     * Minimum clamping progress for fading in all apps content
     */
    protected static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.4f;
    protected static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f;

    /**
     * Minimum clamping progress for fading in all apps scrim
     */
    protected static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = .1f;

    /**
     * The progress at which recents will begin fading out when swiping up from overview.
     * Maximum clamping progress for opaque all apps scrim
     */
    private static final float RECENTS_FADE_THRESHOLD = 0.88f;
    protected static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f;

    private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper;

@@ -122,14 +127,22 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
    private StateAnimationConfig getNormalToAllAppsAnimation() {
        StateAnimationConfig builder = new StateAnimationConfig();
        builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(ACCEL,
                0, ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
                ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD,
                ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
        builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(ACCEL,
                ALL_APPS_SCRIM_VISIBLE_THRESHOLD,
                ALL_APPS_SCRIM_OPAQUE_THRESHOLD));
        return builder;
    }

    private StateAnimationConfig getAllAppsToNormalAnimation() {
        StateAnimationConfig builder = new StateAnimationConfig();
        builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL,
                1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, 1));
                1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
                1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
        builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL,
                1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
                1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
        return builder;
    }

+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MO
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
@@ -98,6 +98,6 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
                state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile()) ? 1f : 0f, LINEAR);

        setter.setViewBackgroundColor(mActivity.getScrimView(), state.getScrimColor(mActivity),
                config.getInterpolator(ANIM_WORKSPACE_SCRIM_FADE, LINEAR));
                config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));
    }
}
+2 −3
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS;
import static com.android.launcher3.graphics.SysUiScrim.SYSUI_PROGRESS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_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_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM;

@@ -166,10 +166,9 @@ public class WorkspaceStateTransitionAnimation {
        propertySetter.setFloat(sysUiScrim, SYSUI_PROGRESS,
                state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);


        propertySetter.setViewBackgroundColor(mLauncher.getScrimView(),
                state.getWorkspaceScrimColor(mLauncher),
                config.getInterpolator(ANIM_WORKSPACE_SCRIM_FADE, LINEAR));
                config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));
    }

    public void applyChildState(LauncherState state, CellLayout cl, int childIndex) {
+6 −8
Original line number Diff line number Diff line
@@ -58,8 +58,7 @@ public class StateAnimationConfig {
            ANIM_OVERVIEW_TRANSLATE_Y,
            ANIM_OVERVIEW_FADE,
            ANIM_ALL_APPS_FADE,
            ANIM_WORKSPACE_SCRIM_FADE,
            ANIM_ALL_APPS_HEADER_FADE,
            ANIM_SCRIM_FADE,
            ANIM_OVERVIEW_MODAL,
            ANIM_DEPTH,
            ANIM_OVERVIEW_ACTIONS_FADE,
@@ -77,13 +76,12 @@ public class StateAnimationConfig {
    public static final int ANIM_OVERVIEW_TRANSLATE_Y = 8;
    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_SCRIM_FADE = 11;
    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];