From a7f2d83b6135a964f01f555342109923c02efe49 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 14 Aug 2024 16:18:51 -0700 Subject: [PATCH] If we're adding / removing a bubble, don't forget to add the overflow One case I missed was a bubble being added/removed AND the overflow showing... this isn't the nicest, but when the add/remove animation is done, animate the overflow in. Flag: com.android.wm.shell.enable_bubble_bar Fixes: 358304168 Test: manual - don't have the overflow showing, add a 6th bubble, observe that the overflow appears Change-Id: I1a9cec3970f5535e935f3404fa6dbd6de2f69fa5 --- .../taskbar/bubbles/BubbleBarController.java | 3 ++- .../launcher3/taskbar/bubbles/BubbleBarView.java | 6 +++++- .../taskbar/bubbles/BubbleBarViewController.java | 12 ++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 33d8a8430f..bdc50388c6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -286,9 +286,10 @@ public class BubbleBarController extends IBubblesListener.Stub { RemovedBubble removedBubble = update.removedBubbles.get(0); BubbleBarBubble bubbleToRemove = mBubbles.remove(removedBubble.getKey()); mBubbles.put(update.addedBubble.getKey(), update.addedBubble); + boolean showOverflow = update.showOverflowChanged && update.showOverflow; if (bubbleToRemove != null) { mBubbleBarViewController.addBubbleAndRemoveBubble(update.addedBubble, - bubbleToRemove, isExpanding, suppressAnimation); + bubbleToRemove, isExpanding, suppressAnimation, showOverflow); } else { mBubbleBarViewController.addBubble(update.addedBubble, isExpanding, suppressAnimation); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 819c4737ea..8330710968 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -756,7 +756,8 @@ public class BubbleBarView extends FrameLayout { } /** Add a new bubble and remove an old bubble from the bubble bar. */ - public void addBubbleAndRemoveBubble(BubbleView addedBubble, BubbleView removedBubble) { + public void addBubbleAndRemoveBubble(BubbleView addedBubble, BubbleView removedBubble, + Runnable onEndRunnable) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams((int) mIconSize, (int) mIconSize, Gravity.LEFT); boolean isOverflowSelected = mSelectedBubbleView.isOverflow(); @@ -790,6 +791,9 @@ public class BubbleBarView extends FrameLayout { removeView(removedBubble); updateWidth(); mBubbleAnimator = null; + if (onEndRunnable != null) { + onEndRunnable.run(); + } } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 3261262621..4fe4ace5d1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -496,8 +496,10 @@ public class BubbleBarViewController { /** Adds a new bubble and removes an old bubble at the same time. */ public void addBubbleAndRemoveBubble(BubbleBarBubble addedBubble, - BubbleBarBubble removedBubble, boolean isExpanding, boolean suppressAnimation) { - mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), removedBubble.getView()); + BubbleBarBubble removedBubble, boolean isExpanding, boolean suppressAnimation, + boolean addOverflowToo) { + mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), removedBubble.getView(), + addOverflowToo ? () -> showOverflow(true) : null); addedBubble.getView().setOnClickListener(mBubbleClickListener); addedBubble.getView().setController(mBubbleViewController); removedBubble.getView().setController(null); @@ -531,7 +533,8 @@ public class BubbleBarViewController { public void addOverflowAndRemoveBubble(BubbleBarBubble removedBubble) { if (mOverflowAdded) return; mOverflowAdded = true; - mBarView.addBubbleAndRemoveBubble(mOverflowBubble.getView(), removedBubble.getView()); + mBarView.addBubbleAndRemoveBubble(mOverflowBubble.getView(), removedBubble.getView(), + null /* onEndRunnable */); mOverflowBubble.getView().setOnClickListener(mBubbleClickListener); mOverflowBubble.getView().setController(mBubbleViewController); removedBubble.getView().setController(null); @@ -541,7 +544,8 @@ public class BubbleBarViewController { public void removeOverflowAndAddBubble(BubbleBarBubble addedBubble) { if (!mOverflowAdded) return; mOverflowAdded = false; - mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), mOverflowBubble.getView()); + mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), mOverflowBubble.getView(), + null /* onEndRunnable */); addedBubble.getView().setOnClickListener(mBubbleClickListener); addedBubble.getView().setController(mBubbleViewController); mOverflowBubble.getView().setController(null);