Move bubble icon / content loading into its own controller class

I think this simplifies the BubbleBarController class and makes it
a bit easier to deal with the optional overflow (done in other CLs).

Flag: com.android.wm.shell.enable_bubble_bar
Test: manual - add some bubble to bubble bar, check that the overflow
               is there & can be opened
Bug: 334175587
Change-Id: Ie17fa0279a981a019d5d50b9f71dc87f49d98dee
This commit is contained in:
Mady Mellor committed 2024-08-02 10:30:00 -07:00
1 parent a75794384c
commit 5e8c0d60cc
5 files changed
+250 -198

No files matched your search

@@ -75,6 +75,7 @@ public class BubbleBarViewController {
private View.OnClickListener mBubbleClickListener;
private View.OnClickListener mBubbleBarClickListener;
private BubbleView.Controller mBubbleViewController;
private BubbleBarOverflow mOverflowBubble;
// These are exposed to {@link BubbleStashController} to animate for stashing/un-stashing
private final MultiValueAlpha mBubbleBarAlpha;
@@ -121,6 +122,8 @@ public class BubbleBarViewController {
mBubbleClickListener = v -> onBubbleClicked((BubbleView) v);
mBubbleBarClickListener = v -> expandBubbleBar();
mBubbleDragController.setupBubbleBarView(mBarView);
mOverflowBubble = bubbleControllers.bubbleCreator.createOverflow(mBarView);
addOverflow();
mBarView.setOnClickListener(mBubbleBarClickListener);
mBarView.addOnLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
@@ -491,6 +494,15 @@ public class BubbleBarViewController {
}
}
/**
* Adds the overflow view to the bubble bar.
*/
public void addOverflow() {
mBarView.addBubble(mOverflowBubble.getView());
mOverflowBubble.getView().setOnClickListener(mBubbleClickListener);
mOverflowBubble.getView().setController(mBubbleViewController);
}
/**
* Adds the provided bubble to the bubble bar.
*/
@@ -501,10 +513,6 @@ public class BubbleBarViewController {
mBubbleDragController.setupBubbleView(b.getView());
b.getView().setController(mBubbleViewController);
if (b instanceof BubbleBarOverflow) {
return;
}
if (suppressAnimation || !(b instanceof BubbleBarBubble bubble)) {
// the bubble bar and handle are initialized as part of the first bubble animation.
// if the animation is suppressed, immediately stash or show the bubble bar to