diff options
Diffstat (limited to 'quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java')
-rw-r--r-- | quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java | 72 |
1 files changed, 50 insertions, 22 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 4e834ec3ef..159a6eff07 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -18,7 +18,7 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.QuickstepTransitionManager.TRANSIENT_TASKBAR_TRANSITION_DURATION; import static com.android.launcher3.statemanager.BaseState.FLAG_NON_INTERACTIVE; import static com.android.launcher3.taskbar.TaskbarEduTooltipControllerKt.TOOLTIP_STEP_FEATURES; -import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_RESUMED; +import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_VISIBLE; import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; import android.animation.Animator; @@ -26,7 +26,6 @@ import android.animation.AnimatorSet; import android.os.RemoteException; import android.util.Log; import android.view.TaskTransitionSpec; -import android.view.View; import android.view.WindowManagerGlobal; import androidx.annotation.NonNull; @@ -41,6 +40,7 @@ import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.InstanceIdSequence; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.taskbar.bubbles.BubbleBarController; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.MultiPropertyFactory; @@ -99,7 +99,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mLauncher.setTaskbarUIController(this); - onLauncherResumedOrPaused(mLauncher.hasBeenResumed(), true /* fromInit */); + onLauncherVisibilityChanged(mLauncher.hasBeenResumed(), true /* fromInit */); onStashedInAppChanged(mLauncher.getDeviceProfile()); mLauncher.addOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener); @@ -118,7 +118,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { @Override protected void onDestroy() { super.onDestroy(); - onLauncherResumedOrPaused(false); + onLauncherVisibilityChanged(false); mTaskbarLauncherStateController.onDestroy(); mLauncher.setTaskbarUIController(null); @@ -159,8 +159,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController { * sub-animations are properly coordinated. This duration should not * actually be used since this animation tracks a swipe progress. */ - protected void addLauncherResumeAnimation(AnimatorSet animation, int placeholderDuration) { - animation.play(onLauncherResumedOrPaused( + protected void addLauncherVisibilityChangedAnimation(AnimatorSet animation, + int placeholderDuration) { + animation.play(onLauncherVisibilityChanged( /* isResumed= */ true, /* fromInit= */ false, /* startAnimation= */ false, @@ -170,40 +171,53 @@ public class LauncherTaskbarUIController extends TaskbarUIController { /** * Should be called from onResume() and onPause(), and animates the Taskbar accordingly. */ - public void onLauncherResumedOrPaused(boolean isResumed) { - onLauncherResumedOrPaused(isResumed, false /* fromInit */); + public void onLauncherVisibilityChanged(boolean isVisible) { + onLauncherVisibilityChanged(isVisible, false /* fromInit */); } - private void onLauncherResumedOrPaused(boolean isResumed, boolean fromInit) { - onLauncherResumedOrPaused( - isResumed, + private void onLauncherVisibilityChanged(boolean isVisible, boolean fromInit) { + onLauncherVisibilityChanged( + isVisible, fromInit, /* startAnimation= */ true, DisplayController.isTransientTaskbar(mLauncher) ? TRANSIENT_TASKBAR_TRANSITION_DURATION - : (!isResumed + : (!isVisible ? QuickstepTransitionManager.TASKBAR_TO_APP_DURATION : QuickstepTransitionManager.TASKBAR_TO_HOME_DURATION)); } @Nullable - private Animator onLauncherResumedOrPaused( - boolean isResumed, boolean fromInit, boolean startAnimation, int duration) { + private Animator onLauncherVisibilityChanged( + boolean isVisible, boolean fromInit, boolean startAnimation, int duration) { // Launcher is resumed during the swipe-to-overview gesture under shell-transitions, so // avoid updating taskbar state in that situation (when it's non-interactive -- or // "background") to avoid premature animations. - if (ENABLE_SHELL_TRANSITIONS && isResumed + if (ENABLE_SHELL_TRANSITIONS && isVisible && mLauncher.getStateManager().getState().hasFlag(FLAG_NON_INTERACTIVE) && !mLauncher.getStateManager().getState().isTaskbarAlignedWithHotseat(mLauncher)) { return null; } - mTaskbarLauncherStateController.updateStateForFlag(FLAG_RESUMED, isResumed); + mTaskbarLauncherStateController.updateStateForFlag(FLAG_VISIBLE, isVisible); return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation); } + @Override + public void onStateTransitionCompletedAfterSwipeToHome(LauncherState state) { + mTaskbarLauncherStateController.onStateTransitionCompletedAfterSwipeToHome(state); + } + + @Override public void refreshResumedState() { - onLauncherResumedOrPaused(mLauncher.hasBeenResumed()); + onLauncherVisibilityChanged(mLauncher.hasBeenResumed()); + } + + @Override + public void adjustHotseatForBubbleBar(boolean isBubbleBarVisible) { + if (mLauncher.getHotseat() != null) { + mLauncher.getHotseat().adjustForBubbleBar(isBubbleBarVisible); + } } /** @@ -279,8 +293,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { // Persistent features EDU tooltip. if (!DisplayController.isTransientTaskbar(mLauncher)) { - return !mLauncher.getOnboardingPrefs().hasReachedMaxCount( - OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP); + return !OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP.hasReachedMax(mLauncher); } // Transient swipe EDU tooltip. @@ -327,10 +340,25 @@ public class LauncherTaskbarUIController extends TaskbarUIController { return mTaskbarInAppDisplayProgress.value > 0; } + public boolean isBubbleBarEnabled() { + return BubbleBarController.isBubbleBarEnabled(); + } + + /** Whether the bubble bar has any bubbles. */ + public boolean hasBubbles() { + if (mControllers == null) { + return false; + } + if (mControllers.bubbleControllers.isEmpty()) { + return false; + } + return mControllers.bubbleControllers.get().bubbleBarViewController.hasBubbles(); + } + @Override public void onExpandPip() { super.onExpandPip(); - mTaskbarLauncherStateController.updateStateForFlag(FLAG_RESUMED, false); + mTaskbarLauncherStateController.updateStateForFlag(FLAG_VISIBLE, false); mTaskbarLauncherStateController.applyState(); } @@ -362,8 +390,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController { } @Override - public void launchSplitTasks(@NonNull View taskView, @NonNull GroupTask groupTask) { - mLauncher.launchSplitTasks(taskView, groupTask); + public void launchSplitTasks(@NonNull GroupTask groupTask) { + mLauncher.launchSplitTasks(groupTask); } @Override |