From cd5591a773eb19c64c66e494870337ca636ea0b8 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Fri, 16 Jun 2023 12:50:45 -0400 Subject: [PATCH] Don't remove the overflow from the bubble bar When a new bubble is added to the bar and we're over the limit remove the second to last bubble instead of the overflow. This change also updates the key of the overflow bubble to match the one in wmshell. Bug: 287121592 Test: manual - Add 6 bubbles to the bubble bar - The overflow bubble should still be there Change-Id: Ibd3ab73be5d3afb49f771a1925ebda2c45b55136 --- .../com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt | 2 +- .../com/android/launcher3/taskbar/bubbles/BubbleBarView.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt index 942a0a199a..582dcc750f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarItem.kt @@ -34,4 +34,4 @@ data class BubbleBarBubble( ) : BubbleBarItem(info.key, view) /** Represents the overflow bubble in the bubble bar. */ -data class BubbleBarOverflow(override val view: BubbleView) : BubbleBarItem("overflow", view) +data class BubbleBarOverflow(override val view: BubbleView) : BubbleBarItem("Overflow", view) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 0e1e0e1a1b..8d2070595b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -150,7 +150,9 @@ public class BubbleBarView extends FrameLayout { @Override public void addView(View child, int index, ViewGroup.LayoutParams params) { if (getChildCount() + 1 > MAX_BUBBLES) { - removeViewInLayout(getChildAt(getChildCount() - 1)); + // the last child view is the overflow bubble and we shouldn't remove that. remove the + // second to last child view. + removeViewInLayout(getChildAt(getChildCount() - 2)); } super.addView(child, index, params); }