diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java index 963f1fa493..fdb80da387 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java @@ -20,6 +20,7 @@ import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS; import android.os.RemoteException; import com.android.launcher3.Launcher; import com.android.launcher3.allapps.AllAppsTransitionController; +import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.RecentsModel; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; @@ -72,4 +73,13 @@ public class BackgroundAppState extends OverviewState { float scale = (float) appWidth / sTempRect.width(); return new float[] { scale, 0f }; } + + @Override + public int getVisibleElements(Launcher launcher) { + if (FeatureFlags.SWIPE_HOME.get()) { + return super.getVisibleElements(launcher); + } + // Hide shelf content (e.g. QSB) because we fade it in when swiping up. + return ALL_APPS_HEADER_EXTRA; + } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index 9650a5316a..96f79a8db8 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -23,6 +23,7 @@ import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_DAMPING_RATIO; import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_STIFFNESS; +import static com.android.launcher3.anim.Interpolators.DEACCEL_3; import static com.android.launcher3.anim.Interpolators.LINEAR; import android.animation.Animator; @@ -38,13 +39,20 @@ import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.UiThread; + import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherInitListener; import com.android.launcher3.LauncherState; +import com.android.launcher3.LauncherStateManager; +import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorPlaybackController; +import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.SpringObjectAnimator; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; @@ -61,10 +69,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import java.util.function.BiPredicate; import java.util.function.Consumer; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.UiThread; - /** * {@link ActivityControlHelper} for the in-launcher recents. */ @@ -211,7 +215,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe : mShelfState == ShelfAnimState.PEEK ? shelfPeekingProgress : shelfOverviewProgress; - mShelfAnim = createShelfAnim(activity, toProgress); + mShelfAnim = createShelfProgressAnim(activity, toProgress); mShelfAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -229,10 +233,10 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe LauncherState fromState, long transitionLength, Consumer callback) { LauncherState endState = OVERVIEW; + DeviceProfile dp = activity.getDeviceProfile(); + long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx); if (wasVisible && fromState != BACKGROUND_APP) { // If a translucent app was launched fom launcher, animate launcher states. - DeviceProfile dp = activity.getDeviceProfile(); - long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx); callback.accept(activity.getStateManager() .createAnimationToNewWorkspace(fromState, endState, accuracy)); return; @@ -245,10 +249,11 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe if (!activity.getDeviceProfile().isVerticalBarLayout() && !FeatureFlags.SWIPE_HOME.get()) { // Don't animate the shelf when SWIPE_HOME is true, because we update it atomically. - Animator shiftAnim = createShelfAnim(activity, + Animator shiftAnim = createShelfProgressAnim(activity, fromState.getVerticalProgress(activity), endState.getVerticalProgress(activity)); anim.play(shiftAnim); + anim.play(createShelfAlphaAnim(activity, endState, accuracy)); } playScaleDownAnim(anim, activity, endState); @@ -265,7 +270,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe callback.accept(controller); } - private Animator createShelfAnim(Launcher activity, float ... progressValues) { + private Animator createShelfProgressAnim(Launcher activity, float ... progressValues) { Animator shiftAnim = new SpringObjectAnimator<>(activity.getAllAppsController(), "allAppsSpringFromACH", activity.getAllAppsController().getShiftRange(), SPRING_DAMPING_RATIO, SPRING_STIFFNESS, progressValues); @@ -273,6 +278,19 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe return shiftAnim; } + /** + * Very quickly fade the alpha of shelf content. + */ + private Animator createShelfAlphaAnim(Launcher activity, LauncherState toState, long accuracy) { + AllAppsTransitionController allAppsController = activity.getAllAppsController(); + AnimatorSetBuilder animBuilder = new AnimatorSetBuilder(); + animBuilder.setInterpolator(AnimatorSetBuilder.ANIM_ALL_APPS_FADE, DEACCEL_3); + LauncherStateManager.AnimationConfig config = new LauncherStateManager.AnimationConfig(); + config.duration = accuracy; + allAppsController.setAlphas(toState.getVisibleElements(activity), config, animBuilder); + return animBuilder.build(); + } + /** * Scale down recents from the center task being full screen to being in overview. */ diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 93bf69daf8..a4ecec7b8e 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -188,9 +188,12 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil private void setAlphas(LauncherState toState, AnimationConfig config, AnimatorSetBuilder builder) { + setAlphas(toState.getVisibleElements(mLauncher), config, builder); + } + + public void setAlphas(int visibleElements, AnimationConfig config, AnimatorSetBuilder builder) { PropertySetter setter = config == null ? NO_ANIM_PROPERTY_SETTER : config.getPropertySetter(builder); - int visibleElements = toState.getVisibleElements(mLauncher); boolean hasHeaderExtra = (visibleElements & ALL_APPS_HEADER_EXTRA) != 0; boolean hasContent = (visibleElements & ALL_APPS_CONTENT) != 0;