From 153cd69d14095e046b37b52bffc0fe18748bd90f Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Tue, 4 Jan 2022 21:40:20 -0800 Subject: [PATCH] Apply scrim protection to atomic state transition ALLAPPS -> NORMAL Bug: 209480401 Test: manual, video attached on the bug TL;DR;; minimized the delta for sc-v2 Change-Id: If8c9281bb4366540b9a4ea10a9b363ce82d78daf --- .../states/QuickstepAtomicAnimationFactory.java | 13 +++++++++++++ .../PortraitStatesTouchController.java | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index 0e2fbbc2bf..75cf5cb3a5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states; import static android.view.View.VISIBLE; +import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.HINT_STATE_TWO_BUTTON; import static com.android.launcher3.LauncherState.NORMAL; @@ -44,6 +45,10 @@ 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_TRANSLATE; +import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD; +import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD; +import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_OPAQUE_THRESHOLD; +import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_VISIBLE_THRESHOLD; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.animation.ValueAnimator; @@ -52,6 +57,7 @@ import com.android.launcher3.CellLayout; import com.android.launcher3.Hotseat; import com.android.launcher3.LauncherState; import com.android.launcher3.Workspace; +import com.android.launcher3.anim.Interpolators; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.quickstep.SysUINavigationMode; @@ -171,6 +177,13 @@ public class QuickstepAtomicAnimationFactory extends mHintToNormalDuration = (int) va.getDuration(); } config.duration = Math.max(config.duration, mHintToNormalDuration); + } else if (fromState == ALL_APPS && toState == NORMAL) { + config.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL, + 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, + 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD)); + config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL, + 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, + 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD)); } } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 3c83d25b71..59ade49761 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -52,22 +52,22 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr /** * The progress at which all apps content will be fully visible. */ - protected static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f; + public static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f; /** * Minimum clamping progress for fading in all apps content */ - protected static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f; + public 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; + public static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = .1f; /** * Maximum clamping progress for opaque all apps scrim */ - protected static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f; + public static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f; private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper;