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

Commit 5a45c345 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Show the dot after the flyout is interrupted

When the bubble notification animation is interrupted, we now
animate the dot back in so that it is visible.

Before this change we unsuppressed the dot which should normally
make the dot visible. The problem was that when the animation is
interrupted we immediately clear the animating bubble field but
showing the dot happens at the end of the flyout fade animation.

This change also animates the dot back in instead of setting the
scale immediately to 1.

Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 379733568
Test: manual
       - launch app
       - send a bubble
       - when the flyout shows, swipe to go home
       - observe animation is cleared and dot is visible
Change-Id: Ie7a10ddf237480ac6555d5f2b40da343394ce77f
parent 232db796
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -351,14 +351,20 @@ public class BubbleView extends ConstraintLayout {
                .start();
    }

    /** Suppresses or un-suppresses drawing the dot due to an update for this bubble. */
    public void suppressDotForBubbleUpdate(boolean suppress) {
        mDotSuppressedForBubbleUpdate = suppress;
        if (suppress) {
    /** Suppresses drawing the dot due to an update for this bubble. */
    public void suppressDotForBubbleUpdate() {
        mDotSuppressedForBubbleUpdate = true;
        setDotScale(0);
        } else {
            showDotIfNeeded(/* animate= */ false);
    }

    /**
     * Unsuppresses the dot after the bubble update finished animating.
     *
     * @param animate whether or not to animate the dot back in
     */
    public void unsuppressDotForBubbleUpdate(boolean animate) {
        mDotSuppressedForBubbleUpdate = false;
        showDotIfNeeded(animate);
    }

    boolean hasUnseenContent() {
+9 −8
Original line number Diff line number Diff line
@@ -486,7 +486,7 @@ constructor(
        if (flyout != null) {
            bubbleBarFlyoutController.setUpAndShowFlyout(
                BubbleBarFlyoutMessage(flyout.icon, flyout.title, flyout.message),
                onInit = { bubbleView.suppressDotForBubbleUpdate(true) },
                onInit = { bubbleView.suppressDotForBubbleUpdate() },
                onEnd = {
                    moveToState(AnimatingBubble.State.IN)
                    bubbleStashController.updateTaskbarTouchRegion()
@@ -498,11 +498,12 @@ constructor(
    }

    private fun cancelFlyout() {
        bubbleBarFlyoutController.cancelFlyout { onFlyoutRemoved() }
        animatingBubble?.bubbleView?.unsuppressDotForBubbleUpdate(/* animate= */ true)
        bubbleBarFlyoutController.cancelFlyout { bubbleStashController.updateTaskbarTouchRegion() }
    }

    private fun onFlyoutRemoved() {
        animatingBubble?.bubbleView?.suppressDotForBubbleUpdate(false)
        animatingBubble?.bubbleView?.unsuppressDotForBubbleUpdate(/* animate= */ false)
        bubbleStashController.updateTaskbarTouchRegion()
    }

@@ -573,7 +574,7 @@ constructor(
        val flyout = bubble?.flyoutMessage
        if (flyout != null) {
            // the flyout is currently expanding and we need to update it with new data
            bubbleView.suppressDotForBubbleUpdate(true)
            bubbleView.suppressDotForBubbleUpdate()
            bubbleBarFlyoutController.updateFlyoutWhileExpanding(flyout)
        } else {
            // the flyout is expanding but we don't have new flyout data to update it with,
@@ -588,7 +589,7 @@ constructor(
        isExpanding: Boolean,
    ) {
        // unsuppress the current bubble because we are about to hide its flyout
        animatingBubble.bubbleView.suppressDotForBubbleUpdate(false)
        animatingBubble.bubbleView.unsuppressDotForBubbleUpdate(/* animate= */ false)
        this.animatingBubble = animatingBubble.copy(bubbleView = bubbleView, expand = isExpanding)

        // we're currently idle, waiting for the hide animation to start. update the flyout
@@ -601,7 +602,7 @@ constructor(
        val bubble = bubbleView.bubble as? BubbleBarBubble
        val flyout = bubble?.flyoutMessage
        if (flyout != null) {
            bubbleView.suppressDotForBubbleUpdate(true)
            bubbleView.suppressDotForBubbleUpdate()
            bubbleBarFlyoutController.updateFlyoutFullyExpanded(flyout) {
                bubbleStashController.updateTaskbarTouchRegion()
            }
@@ -616,7 +617,7 @@ constructor(
        isExpanding: Boolean,
    ) {
        // unsuppress the current bubble because we are about to hide its flyout
        animatingBubble.bubbleView.suppressDotForBubbleUpdate(false)
        animatingBubble.bubbleView.unsuppressDotForBubbleUpdate(/* animate= */ false)
        this.animatingBubble = animatingBubble.copy(bubbleView = bubbleView, expand = isExpanding)

        // the hide animation already started so it can't be canceled, just post it again
@@ -629,7 +630,7 @@ constructor(
            // the flyout is collapsing. update it with the new flyout
            if (flyout != null) {
                moveToState(AnimatingBubble.State.ANIMATING_IN)
                bubbleView.suppressDotForBubbleUpdate(true)
                bubbleView.suppressDotForBubbleUpdate()
                bubbleBarFlyoutController.updateFlyoutWhileCollapsing(flyout) {
                    moveToState(AnimatingBubble.State.IN)
                    bubbleStashController.updateTaskbarTouchRegion()