Skip to content
Snippets Groups Projects
Commit 786b4c14 authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Fix flicker when dismissing last bubble in bubble bar" into main

parents a3ea4b5f a2413a86
No related branches found
No related tags found
No related merge requests found
......@@ -1799,11 +1799,12 @@ public class BubbleController implements ConfigurationChangeListener,
@Override
public void removeBubble(Bubble removedBubble) {
if (mLayerView != null) {
mLayerView.removeBubble(removedBubble);
if (!mBubbleData.hasBubbles() && !isStackExpanded()) {
mLayerView.setVisibility(INVISIBLE);
removeFromWindowManagerMaybe();
}
mLayerView.removeBubble(removedBubble, () -> {
if (!mBubbleData.hasBubbles() && !isStackExpanded()) {
mLayerView.setVisibility(INVISIBLE);
removeFromWindowManagerMaybe();
}
});
}
}
......
......@@ -242,13 +242,17 @@ public class BubbleBarLayerView extends FrameLayout
}
/** Removes the given {@code bubble}. */
public void removeBubble(Bubble bubble) {
public void removeBubble(Bubble bubble, Runnable endAction) {
Runnable cleanUp = () -> {
bubble.cleanupViews();
endAction.run();
};
if (mBubbleData.getBubbles().isEmpty()) {
// we're removing the last bubble. collapse the expanded view and cleanup bubble views
// at the end.
collapse(bubble::cleanupViews);
collapse(cleanUp);
} else {
bubble.cleanupViews();
cleanUp.run();
}
}
......@@ -264,6 +268,9 @@ public class BubbleBarLayerView extends FrameLayout
*/
public void collapse(@Nullable Runnable endAction) {
if (!mIsExpanded) {
if (endAction != null) {
endAction.run();
}
return;
}
mIsExpanded = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment