Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2413a86 authored by Ats Jenk's avatar Ats Jenk
Browse files

Fix flicker when dismissing last bubble in bubble bar

Fixes a flicker in dismiss animation for bubble expanded view when it is
the last bubble in the bubble bar.
Delay removing bubble bar layer view from window manager until the
dismiss animation completes.

Bug: 283991264
Test: manual, have 1 bubble expanded with bubble bar, drag it to dismiss
    view, check there are no visual flickers in the remove animation
Test: manual, check in web-hv that BubbleBarLayerView is removed when:
    - drag collapsed bubble bar to dismiss target
    - expand bubble, drag bubble to dismiss target
    - expand bubble, drag expanded view to dismiss target
Change-Id: I29495672c7587d61e4bd2dd717ed5fe83136e366
parent db88ed78
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1774,11 +1774,12 @@ public class BubbleController implements ConfigurationChangeListener,
        @Override
        public void removeBubble(Bubble removedBubble) {
            if (mLayerView != null) {
                mLayerView.removeBubble(removedBubble);
                mLayerView.removeBubble(removedBubble, () -> {
                    if (!mBubbleData.hasBubbles() && !isStackExpanded()) {
                        mLayerView.setVisibility(INVISIBLE);
                        removeFromWindowManagerMaybe();
                    }
                });
            }
        }

+10 −3
Original line number Diff line number Diff line
@@ -241,13 +241,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();
        }
    }

@@ -263,6 +267,9 @@ public class BubbleBarLayerView extends FrameLayout
     */
    public void collapse(@Nullable Runnable endAction) {
        if (!mIsExpanded) {
            if (endAction != null) {
                endAction.run();
            }
            return;
        }
        mIsExpanded = false;