diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index b1cb2c6e67..7dc1669f61 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -33,6 +33,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Flags; +import com.android.launcher3.Hotseat; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; @@ -83,6 +84,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { private final DeviceProfile.OnDeviceProfileChangeListener mOnDeviceProfileChangeListener = dp -> { onStashedInAppChanged(dp); + adjustHotseatForBubbleBar(); if (mControllers != null && mControllers.taskbarViewController != null) { mControllers.taskbarViewController.onRotationChanged(dp); } @@ -263,6 +265,14 @@ public class LauncherTaskbarUIController extends TaskbarUIController { } } + private void adjustHotseatForBubbleBar() { + Hotseat hotseat = mLauncher.getHotseat(); + if (mControllers.bubbleControllers.isEmpty() || hotseat == null) return; + boolean hiddenForBubbles = + mControllers.bubbleControllers.get().bubbleBarViewController.isHiddenForNoBubbles(); + hotseat.post(() -> adjustHotseatForBubbleBar(!hiddenForBubbles)); + } + /** * Create Taskbar animation when going from an app to Launcher as part of recents transition. * @param toState If known, the state we will end up in when reaching Launcher. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java index 5a63ca69aa..db707247ad 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java @@ -221,10 +221,13 @@ public class TaskbarControllers { uiController = newUiController; uiController.init(this); uiController.updateStateForSysuiFlags(mSharedState.sysuiStateFlags); - // if bubble controllers are present take bubble bar location, else set it to null + // if bubble controllers are present configure the UI controller bubbleControllers.ifPresentOrElse(bubbleControllers -> { BubbleBarLocation location = bubbleControllers.bubbleBarViewController.getBubbleBarLocation(); + boolean hiddenForBubbles = + bubbleControllers.bubbleBarViewController.isHiddenForNoBubbles(); + uiController.adjustHotseatForBubbleBar(!hiddenForBubbles); uiController.onBubbleBarLocationUpdated(location); }, () -> uiController.onBubbleBarLocationUpdated(null)); // Notify that the ui controller has changed diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 6468f749ac..b2ccba431c 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -187,22 +187,20 @@ public class Hotseat extends CellLayout implements Insettable { public void adjustForBubbleBar(boolean isBubbleBarVisible) { DeviceProfile dp = mActivity.getDeviceProfile(); float adjustedBorderSpace = dp.getHotseatAdjustedBorderSpaceForBubbleBar(getContext()); - boolean adjustmentRequired = Float.compare(adjustedBorderSpace, 0f) != 0; - + boolean shouldAdjustHotseat = isBubbleBarVisible + && Float.compare(adjustedBorderSpace, 0f) != 0; ShortcutAndWidgetContainer icons = getShortcutsAndWidgets(); // update the translation provider for future layout passes of hotseat icons. - if (adjustmentRequired && isBubbleBarVisible) { + if (shouldAdjustHotseat) { icons.setTranslationProvider( cellX -> dp.getHotseatAdjustedTranslation(getContext(), cellX)); } else { icons.setTranslationProvider(null); } - if (!adjustmentRequired) return; - AnimatorSet animatorSet = new AnimatorSet(); for (int i = 0; i < icons.getChildCount(); i++) { View child = icons.getChildAt(i); - float tx = isBubbleBarVisible ? dp.getHotseatAdjustedTranslation(getContext(), i) : 0; + float tx = shouldAdjustHotseat ? dp.getHotseatAdjustedTranslation(getContext(), i) : 0; if (child instanceof Reorderable) { MultiTranslateDelegate mtd = ((Reorderable) child).getTranslateDelegate(); animatorSet.play( @@ -213,8 +211,8 @@ public class Hotseat extends CellLayout implements Insettable { } if (mQsb instanceof HorizontalInsettableView horizontalInsettableQsb) { final float currentInsetFraction = horizontalInsettableQsb.getHorizontalInsets(); - final float targetInsetFraction = - isBubbleBarVisible ? (float) dp.iconSizePx / dp.hotseatQsbWidth : 0; + final float targetInsetFraction = shouldAdjustHotseat + ? (float) dp.iconSizePx / dp.hotseatQsbWidth : 0; ValueAnimator qsbAnimator = ValueAnimator.ofFloat(currentInsetFraction, targetInsetFraction); qsbAnimator.addUpdateListener(animation -> {