Add a new bubble at limit while expanded
Handles adding a new bubble and removing an old bubble when the bar is expanded and at the limit. Demo when bar is on right: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/dxhFKrctdR5I2F6Pvho6u8 Demo when bar is on left: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/er4ZGQfg8OKHZ2aTi9OJ9N Flag: com.android.wm.shell.enable_bubble_bar Test: demos Test: atest BubbleViewAnimatorTest Fixes: 345795791 Change-Id: I4e75d61c8afdb81340823a1d77e55b15e3fd6bc0
This commit is contained in:
1 parent
c1391754ff
commit
2e1dd4644b
5 files changed
+241
-37
No files matched your search
@@ -322,27 +322,45 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
|| mImeVisibilityChecker.isImeVisible();
|
||||
|
||||
BubbleBarBubble bubbleToSelect = null;
|
||||
if (!update.removedBubbles.isEmpty()) {
|
||||
for (int i = 0; i < update.removedBubbles.size(); i++) {
|
||||
RemovedBubble removedBubble = update.removedBubbles.get(i);
|
||||
BubbleBarBubble bubble = mBubbles.remove(removedBubble.getKey());
|
||||
if (bubble != null) {
|
||||
mBubbleBarViewController.removeBubble(bubble);
|
||||
} else {
|
||||
Log.w(TAG, "trying to remove bubble that doesn't exist: "
|
||||
+ removedBubble.getKey());
|
||||
|
||||
if (update.addedBubble != null && update.removedBubbles.size() == 1) {
|
||||
// we're adding and removing a bubble at the same time. handle this as a single update.
|
||||
RemovedBubble removedBubble = update.removedBubbles.get(0);
|
||||
BubbleBarBubble bubbleToRemove = mBubbles.remove(removedBubble.getKey());
|
||||
mBubbles.put(update.addedBubble.getKey(), update.addedBubble);
|
||||
if (bubbleToRemove != null) {
|
||||
mBubbleBarViewController.addBubbleAndRemoveBubble(update.addedBubble,
|
||||
bubbleToRemove, isExpanding, suppressAnimation);
|
||||
} else {
|
||||
mBubbleBarViewController.addBubble(update.addedBubble, isExpanding,
|
||||
suppressAnimation);
|
||||
Log.w(TAG, "trying to remove bubble that doesn't exist: " + removedBubble.getKey());
|
||||
}
|
||||
} else {
|
||||
if (!update.removedBubbles.isEmpty()) {
|
||||
for (int i = 0; i < update.removedBubbles.size(); i++) {
|
||||
RemovedBubble removedBubble = update.removedBubbles.get(i);
|
||||
BubbleBarBubble bubble = mBubbles.remove(removedBubble.getKey());
|
||||
if (bubble != null) {
|
||||
mBubbleBarViewController.removeBubble(bubble);
|
||||
} else {
|
||||
Log.w(TAG, "trying to remove bubble that doesn't exist: "
|
||||
+ removedBubble.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (update.addedBubble != null) {
|
||||
mBubbles.put(update.addedBubble.getKey(), update.addedBubble);
|
||||
mBubbleBarViewController.addBubble(update.addedBubble, isExpanding, suppressAnimation);
|
||||
if (isCollapsed) {
|
||||
// If we're collapsed, the most recently added bubble will be selected.
|
||||
bubbleToSelect = update.addedBubble;
|
||||
if (update.addedBubble != null) {
|
||||
mBubbles.put(update.addedBubble.getKey(), update.addedBubble);
|
||||
mBubbleBarViewController.addBubble(update.addedBubble, isExpanding,
|
||||
suppressAnimation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (update.addedBubble != null && isCollapsed) {
|
||||
// If we're collapsed, the most recently added bubble will be selected.
|
||||
bubbleToSelect = update.addedBubble;
|
||||
}
|
||||
|
||||
if (update.currentBubbles != null && !update.currentBubbles.isEmpty()) {
|
||||
// Iterate in reverse because new bubbles are added in front and the list is in order.
|
||||
for (int i = update.currentBubbles.size() - 1; i >= 0; i--) {
|
||||
|
||||
Reference in new issue
Block a user