diff options
Diffstat (limited to 'src/com/android/launcher3/LauncherStateManager.java')
-rw-r--r-- | src/com/android/launcher3/LauncherStateManager.java | 62 |
1 files changed, 3 insertions, 59 deletions
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 4425e2af6..505918e09 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -16,23 +16,7 @@ package com.android.launcher3; -import static android.view.View.VISIBLE; - 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.AnimatorSetBuilder.ANIM_OVERVIEW_FADE; -import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE; -import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X; -import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_FADE; -import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_SCALE; -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.INSTANT; -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.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import android.animation.Animator; @@ -42,8 +26,6 @@ import android.os.Handler; import android.os.Looper; import android.util.Log; -import androidx.annotation.IntDef; - import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.AnimatorSetBuilder; @@ -58,6 +40,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; +import androidx.annotation.IntDef; + /** * TODO: figure out what kind of tests we can write for this * @@ -314,47 +298,7 @@ public class LauncherStateManager { */ public void prepareForAtomicAnimation(LauncherState fromState, LauncherState toState, AnimatorSetBuilder builder) { - if (fromState == NORMAL && toState == OVERVIEW) { - builder.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2); - builder.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2); - builder.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2); - builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7); - builder.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2); - - // Start from a higher overview scale, but only if we're invisible so we don't jump. - UiFactory.prepareToShowOverview(mLauncher); - } else if (fromState == OVERVIEW && toState == NORMAL) { - builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL); - builder.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL); - builder.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f)); - builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL); - builder.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 = workspace.getHotseat(); - boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0; - if (!isHotseatVisible) { - hotseat.setScaleX(0.92f); - hotseat.setScaleY(0.92f); - } - } else if (fromState == NORMAL && toState == OVERVIEW_PEEK) { - builder.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT); - } else if (fromState == OVERVIEW_PEEK && toState == NORMAL) { - // Keep fully visible until the very end (when overview is offscreen) to make invisible. - builder.setInterpolator(ANIM_OVERVIEW_FADE, t -> t < 1 ? 0 : 1); - } + toState.prepareForAtomicAnimation(mLauncher, fromState, builder); } public AnimatorSet createAtomicAnimation(LauncherState fromState, LauncherState toState, |