Support optional bubble overflow in bubble bar
This is similar to the animations that add / remove a bubble at the
same time -- the overflow is generally added when a bubble is removed.
The overflow is generally removed when a bubble is added (i.e. user
promotes a bubble out of the overflow).
There are a couple of additional cases:
- when bubbles are first added to the bar -- if there were saved
bubbles in the overflow, the view should be added
- an app could cancel its bubbles / remove its shortcuts and not have
any in the stack but could have some in the overflow & it could
become empty without an addition.
Flag: com.android.wm.shell.enable_optional_bubble_overflow
Flag: com.android.wm.shell.enable_bubble_bar
Test: manual - add bubbles to the bubble bar for first time
=> observe there is no overflow
- dismiss a bubble
=> observe the overflow is added, tap on it, tap on the
bubble in it
=> observe that bubble is added & the overflow disappears
- dismiss all the bubbles
- add a bubble
=> observe the overflow is there & has the previously
dismissed bubbles
- cancel all the bubbles that are in the overflow via
adb
=> observe the overflow is remvoed
Bug: 334175587
Change-Id: I2b6e855e65520b4b2b1fde7757d46f00a468b4a6
This commit is contained in:
1 parent
d9873c1039
commit
8c629fd8b5
4 files changed
+121
-40
No files matched your search
@@ -92,6 +92,8 @@ public class BubbleBarViewController {
|
||||
private boolean mHiddenForNoBubbles = true;
|
||||
private boolean mShouldShowEducation;
|
||||
|
||||
public boolean mOverflowAdded;
|
||||
|
||||
private BubbleBarViewAnimator mBubbleBarViewAnimator;
|
||||
|
||||
private final TimeSource mTimeSource = System::currentTimeMillis;
|
||||
@@ -123,7 +125,6 @@ public class BubbleBarViewController {
|
||||
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) -> {
|
||||
@@ -494,13 +495,44 @@ public class BubbleBarViewController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the overflow view to the bubble bar.
|
||||
*/
|
||||
public void addOverflow() {
|
||||
mBarView.addBubble(mOverflowBubble.getView());
|
||||
/** Whether the overflow view is added to the bubble bar. */
|
||||
public boolean isOverflowAdded() {
|
||||
return mOverflowAdded;
|
||||
}
|
||||
|
||||
/** Shows or hides the overflow view. */
|
||||
public void showOverflow(boolean showOverflow) {
|
||||
if (mOverflowAdded == showOverflow) return;
|
||||
mOverflowAdded = showOverflow;
|
||||
if (mOverflowAdded) {
|
||||
mBarView.addBubble(mOverflowBubble.getView());
|
||||
mOverflowBubble.getView().setOnClickListener(mBubbleClickListener);
|
||||
mOverflowBubble.getView().setController(mBubbleViewController);
|
||||
} else {
|
||||
mBarView.removeBubble(mOverflowBubble.getView());
|
||||
mOverflowBubble.getView().setOnClickListener(null);
|
||||
mOverflowBubble.getView().setController(null);
|
||||
}
|
||||
}
|
||||
|
||||
/** Adds the overflow view to the bubble bar while animating a view away. */
|
||||
public void addOverflowAndRemoveBubble(BubbleBarBubble removedBubble) {
|
||||
if (mOverflowAdded) return;
|
||||
mOverflowAdded = true;
|
||||
mBarView.addBubbleAndRemoveBubble(mOverflowBubble.getView(), removedBubble.getView());
|
||||
mOverflowBubble.getView().setOnClickListener(mBubbleClickListener);
|
||||
mOverflowBubble.getView().setController(mBubbleViewController);
|
||||
removedBubble.getView().setController(null);
|
||||
}
|
||||
|
||||
/** Removes the overflow view to the bubble bar while animating a view in. */
|
||||
public void removeOverflowAndAddBubble(BubbleBarBubble addedBubble) {
|
||||
if (!mOverflowAdded) return;
|
||||
mOverflowAdded = false;
|
||||
mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), mOverflowBubble.getView());
|
||||
addedBubble.getView().setOnClickListener(mBubbleClickListener);
|
||||
addedBubble.getView().setController(mBubbleViewController);
|
||||
mOverflowBubble.getView().setController(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user