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

Commit f67db353 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Moving animation configuration and definition out of state definition

This removes cross dependency between StateManager and State object so
that it can be easily generalized

Change-Id: I62851fc4b653655cb40f37023db9651055ec7c9c
parent 7826bf52
Loading
Loading
Loading
Loading
+0 −95
Original line number Diff line number Diff line
@@ -16,39 +16,24 @@

package com.android.launcher3;

import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
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_VERTICAL_PROGRESS;
import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch;
import static com.android.quickstep.TaskViewUtils.getRecentsWindowAnimator;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.view.View;

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

import com.android.launcher3.LauncherState.ScaleAndTranslation;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.SpringAnimationBuilder;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -59,13 +44,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
 */
public final class LauncherAppTransitionManagerImpl extends QuickstepAppTransitionManagerImpl {

    public static final int INDEX_SHELF_ANIM = 0;
    public static final int INDEX_RECENTS_FADE_ANIM = 1;
    public static final int INDEX_RECENTS_TRANSLATE_X_ANIM = 2;
    public static final int INDEX_PAUSE_TO_OVERVIEW_ANIM = 3;

    public static final long ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW = 300;

    public LauncherAppTransitionManagerImpl(Context context) {
        super(context);
    }
@@ -151,77 +129,4 @@ public final class LauncherAppTransitionManagerImpl extends QuickstepAppTransiti
            mLauncher.getStateManager().reapplyState();
        };
    }

    @Override
    public int getStateElementAnimationsCount() {
        return 4;
    }

    @Override
    public Animator createStateElementAnimation(int index, float... values) {
        switch (index) {
            case INDEX_SHELF_ANIM: {
                AllAppsTransitionController aatc = mLauncher.getAllAppsController();
                Animator springAnim = aatc.createSpringAnimation(values);

                if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) {
                    // Translate hotseat with the shelf until reaching overview.
                    float overviewProgress = OVERVIEW.getVerticalProgress(mLauncher);
                    ScaleAndTranslation sat = OVERVIEW.getHotseatScaleAndTranslation(mLauncher);
                    float shiftRange = aatc.getShiftRange();
                    if (values.length == 1) {
                        values = new float[] {aatc.getProgress(), values[0]};
                    }
                    ValueAnimator hotseatAnim = ValueAnimator.ofFloat(values);
                    hotseatAnim.addUpdateListener(anim -> {
                        float progress = (Float) anim.getAnimatedValue();
                        if (progress >= overviewProgress || mLauncher.isInState(BACKGROUND_APP)) {
                            float hotseatShift = (progress - overviewProgress) * shiftRange;
                            mLauncher.getHotseat().setTranslationY(hotseatShift + sat.translationY);
                        }
                    });
                    hotseatAnim.setInterpolator(LINEAR);
                    hotseatAnim.setDuration(springAnim.getDuration());

                    AnimatorSet anim = new AnimatorSet();
                    anim.play(hotseatAnim);
                    anim.play(springAnim);
                    return anim;
                }

                return springAnim;
            }
            case INDEX_RECENTS_FADE_ANIM:
                return ObjectAnimator.ofFloat(mLauncher.getOverviewPanel(),
                        RecentsView.CONTENT_ALPHA, values);
            case INDEX_RECENTS_TRANSLATE_X_ANIM: {
                RecentsView rv = mLauncher.getOverviewPanel();
                return new SpringAnimationBuilder(mLauncher)
                        .setMinimumVisibleChange(1f / rv.getPageOffsetScale())
                        .setDampingRatio(0.8f)
                        .setStiffness(250)
                        .setValues(values)
                        .build(rv, ADJACENT_PAGE_OFFSET);
            }
            case INDEX_PAUSE_TO_OVERVIEW_ANIM: {
                StateAnimationConfig config = new StateAnimationConfig();
                config.duration = ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW;

                config.setInterpolator(ANIM_VERTICAL_PROGRESS, OVERSHOOT_1_2);
                config.setInterpolator(ANIM_ALL_APPS_FADE, DEACCEL_3);
                if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) {
                    config.setInterpolator(ANIM_HOTSEAT_SCALE, OVERSHOOT_1_2);
                    config.setInterpolator(ANIM_HOTSEAT_TRANSLATE, OVERSHOOT_1_2);
                }


                LauncherStateManager stateManager = mLauncher.getStateManager();
                return stateManager.createAtomicAnimation(
                        stateManager.getCurrentStableState(), OVERVIEW, config);
            }

            default:
                return super.createStateElementAnimation(index, values);
        }
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AtomicAnimationFactory;
import com.android.launcher3.Workspace;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimatorPlaybackController;
@@ -48,6 +49,7 @@ import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory;
import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController;
import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController;
@@ -278,6 +280,11 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
        return list.toArray(new TouchController[list.size()]);
    }

    @Override
    public AtomicAnimationFactory createAtomicAnimationFactory() {
        return new QuickstepAtomicAnimationFactory(this);
    }

    private static final class LauncherTaskViewController extends
            TaskViewTouchController<Launcher> {

+0 −19
Original line number Diff line number Diff line
@@ -15,16 +15,7 @@
 */
package com.android.launcher3.uioverrides.states;

import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;

import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.states.StateAnimationConfig;

public class OverviewPeekState extends OverviewState {
    private static final float OVERVIEW_OFFSET = 0.7f;
@@ -37,14 +28,4 @@ public class OverviewPeekState extends OverviewState {
    public float[] getOverviewScaleAndOffset(Launcher launcher) {
        return new float[] {NO_SCALE, OVERVIEW_OFFSET};
    }

    @Override
    public void prepareForAtomicAnimation(Launcher launcher, LauncherState fromState,
            StateAnimationConfig config) {
        if (this == OVERVIEW_PEEK && fromState == NORMAL) {
            config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT);
            config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7);
            config.setInterpolator(ANIM_OVERVIEW_SCRIM_FADE, FAST_OUT_SLOW_IN);
        }
    }
}
+0 −47
Original line number Diff line number Diff line
@@ -15,36 +15,21 @@
 */
package com.android.launcher3.uioverrides.states;

import static android.view.View.VISIBLE;

import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
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.StateAnimationConfig.ANIM_OVERVIEW_FADE;
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_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.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;

import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.animation.Interpolator;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Workspace;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.SysUINavigationMode;
@@ -57,9 +42,6 @@ import com.android.quickstep.views.TaskView;
 */
public class OverviewState extends LauncherState {

    // Scale recents takes before animating in
    private static final float RECENTS_PREPARE_SCALE = 1.33f;

    protected static final Rect sTempRect = new Rect();

    private static final int STATE_FLAGS = FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED
@@ -202,35 +184,6 @@ public class OverviewState extends LauncherState {
        }
    }

    @Override
    public void prepareForAtomicAnimation(Launcher launcher, LauncherState fromState,
            StateAnimationConfig config) {
        if ((fromState == NORMAL || fromState == HINT_STATE) && this == OVERVIEW) {
            if (SysUINavigationMode.getMode(launcher) == NO_BUTTON) {
                config.setInterpolator(ANIM_WORKSPACE_SCALE,
                        fromState == NORMAL ? ACCEL : OVERSHOOT_1_2);
                config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
            } else {
                config.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2);

                // Scale up the recents, if it is not coming from the side
                RecentsView overview = launcher.getOverviewPanel();
                if (overview.getVisibility() != VISIBLE || overview.getContentAlpha() == 0) {
                    SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE);
                }
            }
            config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2);
            config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
            Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get()
                    && removeShelfFromOverview(launcher)
                    ? OVERSHOOT_1_2
                    : OVERSHOOT_1_7;
            config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, translationInterpolator);
            config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, translationInterpolator);
            config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
        }
    }

    public static OverviewState newBackgroundState(int id) {
        return new BackgroundAppState(id);
    }
+236 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.launcher3.uioverrides.states;

import static android.view.View.VISIBLE;

import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_PEEK;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
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_OVERVIEW_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE;
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_VERTICAL_PROGRESS;
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.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.animation.Interpolator;

import com.android.launcher3.CellLayout;
import com.android.launcher3.Hotseat;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherState.ScaleAndTranslation;
import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.LauncherStateManager.AtomicAnimationFactory;
import com.android.launcher3.Workspace;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.SpringAnimationBuilder;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.views.RecentsView;

/**
 * Animation factory for quickstep specific transitions
 */
public class QuickstepAtomicAnimationFactory extends AtomicAnimationFactory {

    // Scale recents takes before animating in
    private static final float RECENTS_PREPARE_SCALE = 1.33f;

    public static final int INDEX_SHELF_ANIM = 0;
    public static final int INDEX_RECENTS_FADE_ANIM = 1;
    public static final int INDEX_RECENTS_TRANSLATE_X_ANIM = 2;
    public static final int INDEX_PAUSE_TO_OVERVIEW_ANIM = 3;
    private static final int ANIM_COUNT = 4;

    public static final long ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW = 300;

    private final QuickstepLauncher mLauncher;

    public QuickstepAtomicAnimationFactory(QuickstepLauncher launcher) {
        super(ANIM_COUNT);
        mLauncher = launcher;
    }

    @Override
    public Animator createStateElementAnimation(int index, float... values) {
        switch (index) {
            case INDEX_SHELF_ANIM: {
                AllAppsTransitionController aatc = mLauncher.getAllAppsController();
                Animator springAnim = aatc.createSpringAnimation(values);

                if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) {
                    // Translate hotseat with the shelf until reaching overview.
                    float overviewProgress = OVERVIEW.getVerticalProgress(mLauncher);
                    ScaleAndTranslation sat = OVERVIEW.getHotseatScaleAndTranslation(mLauncher);
                    float shiftRange = aatc.getShiftRange();
                    if (values.length == 1) {
                        values = new float[] {aatc.getProgress(), values[0]};
                    }
                    ValueAnimator hotseatAnim = ValueAnimator.ofFloat(values);
                    hotseatAnim.addUpdateListener(anim -> {
                        float progress = (Float) anim.getAnimatedValue();
                        if (progress >= overviewProgress || mLauncher.isInState(BACKGROUND_APP)) {
                            float hotseatShift = (progress - overviewProgress) * shiftRange;
                            mLauncher.getHotseat().setTranslationY(hotseatShift + sat.translationY);
                        }
                    });
                    hotseatAnim.setInterpolator(LINEAR);
                    hotseatAnim.setDuration(springAnim.getDuration());

                    AnimatorSet anim = new AnimatorSet();
                    anim.play(hotseatAnim);
                    anim.play(springAnim);
                    return anim;
                }

                return springAnim;
            }
            case INDEX_RECENTS_FADE_ANIM:
                return ObjectAnimator.ofFloat(mLauncher.getOverviewPanel(),
                        RecentsView.CONTENT_ALPHA, values);
            case INDEX_RECENTS_TRANSLATE_X_ANIM: {
                RecentsView rv = mLauncher.getOverviewPanel();
                return new SpringAnimationBuilder(mLauncher)
                        .setMinimumVisibleChange(1f / rv.getPageOffsetScale())
                        .setDampingRatio(0.8f)
                        .setStiffness(250)
                        .setValues(values)
                        .build(rv, ADJACENT_PAGE_OFFSET);
            }
            case INDEX_PAUSE_TO_OVERVIEW_ANIM: {
                StateAnimationConfig config = new StateAnimationConfig();
                config.duration = ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW;

                config.setInterpolator(ANIM_VERTICAL_PROGRESS, OVERSHOOT_1_2);
                config.setInterpolator(ANIM_ALL_APPS_FADE, DEACCEL_3);
                if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) {
                    config.setInterpolator(ANIM_HOTSEAT_SCALE, OVERSHOOT_1_2);
                    config.setInterpolator(ANIM_HOTSEAT_TRANSLATE, OVERSHOOT_1_2);
                }

                LauncherStateManager stateManager = mLauncher.getStateManager();
                return stateManager.createAtomicAnimation(
                        stateManager.getCurrentStableState(), OVERVIEW, config);
            }

            default:
                return super.createStateElementAnimation(index, values);
        }
    }

    @Override
    public void prepareForAtomicAnimation(LauncherState fromState, LauncherState toState,
            StateAnimationConfig config) {
        if (toState == NORMAL && fromState == OVERVIEW) {
            config.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL);
            config.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL);
            config.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
            config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL);
            config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
            Workspace workspace = mLauncher.getWorkspace();

            // Start from a higher workspace scale, but only if we're invisible so we don't jump.
            boolean isWorkspaceVisible = workspace.getVisibility() == VISIBLE;
            if (isWorkspaceVisible) {
                CellLayout currentChild = (CellLayout) workspace.getChildAt(
                        workspace.getCurrentPage());
                isWorkspaceVisible = currentChild.getVisibility() == VISIBLE
                        && currentChild.getShortcutsAndWidgets().getAlpha() > 0;
            }
            if (!isWorkspaceVisible) {
                workspace.setScaleX(0.92f);
                workspace.setScaleY(0.92f);
            }
            Hotseat hotseat = mLauncher.getHotseat();
            boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0;
            if (!isHotseatVisible) {
                hotseat.setScaleX(0.92f);
                hotseat.setScaleY(0.92f);
                if (ENABLE_OVERVIEW_ACTIONS.get()) {
                    AllAppsContainerView qsbContainer = mLauncher.getAppsView();
                    View qsb = qsbContainer.getSearchView();
                    boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0;
                    if (!qsbVisible) {
                        qsbContainer.setScaleX(0.92f);
                        qsbContainer.setScaleY(0.92f);
                    }
                }
            }
        } else if (toState == NORMAL && fromState == OVERVIEW_PEEK) {
            // Keep fully visible until the very end (when overview is offscreen) to make invisible.
            config.setInterpolator(ANIM_OVERVIEW_FADE, t -> t < 1 ? 0 : 1);
        } else if (toState == OVERVIEW_PEEK && fromState == NORMAL) {
            config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT);
            config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7);
            config.setInterpolator(ANIM_OVERVIEW_SCRIM_FADE, FAST_OUT_SLOW_IN);
        } else if ((fromState == NORMAL || fromState == HINT_STATE) && toState == OVERVIEW) {
            if (SysUINavigationMode.getMode(mLauncher) == NO_BUTTON) {
                config.setInterpolator(ANIM_WORKSPACE_SCALE,
                        fromState == NORMAL ? ACCEL : OVERSHOOT_1_2);
                config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
            } else {
                config.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2);

                // Scale up the recents, if it is not coming from the side
                RecentsView overview = mLauncher.getOverviewPanel();
                if (overview.getVisibility() != VISIBLE || overview.getContentAlpha() == 0) {
                    SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE);
                }
            }
            config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2);
            config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
            Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get()
                    && removeShelfFromOverview(mLauncher)
                    ? OVERSHOOT_1_2
                    : OVERSHOOT_1_7;
            config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, translationInterpolator);
            config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, translationInterpolator);
            config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
        }
    }
}
Loading