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

Commit 698d9e89 authored by Mady Mellor's avatar Mady Mellor Committed by Joshua Tsuji
Browse files

Revert "Animate out bubbles in reverse of the way they animate in."

This reverts commit 90ff97ee.

Reason for revert: breaks some tests / behaviour; revert til fix
Change-Id: I40cee68dcd637d574bff4add692b3ef636e2e6f3
parent 888ae369
Loading
Loading
Loading
Loading
+3 −19
Original line number Diff line number Diff line
@@ -802,32 +802,16 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        if (mStackView == null) {
            return;
        }

        if (mStatusBarStateListener.getCurrentState() == SHADE && hasBubbles()) {
            // Bubbles only appear in unlocked shade
            mStackView.setVisibility(hasBubbles() ? VISIBLE : INVISIBLE);
        } else if (!hasBubbles() && mStackView.hasTransientBubbles()) {
            // If we only have transient bubbles, then wait until they're gone.
            mStackView.runActionAfterTransientViewAnimations(() -> {
                mStackView.setVisibility(INVISIBLE);
                updateBubblesShowing();
            });
        } else {
        } else if (mStackView != null) {
            mStackView.setVisibility(INVISIBLE);
        }

        updateBubblesShowing();
    }

    /**
     * Updates the status bar window controller and the state change listener with whether bubbles
     * are currently showing.
     */
    public void updateBubblesShowing() {
        // Let listeners know if bubble state changed.
        boolean hadBubbles = mStatusBarWindowController.getBubblesShowing();
        boolean hasBubblesShowing =
                (hasBubbles() || mStackView.hasTransientBubbles())
                        && mStackView.getVisibility() == VISIBLE;
        boolean hasBubblesShowing = hasBubbles() && mStackView.getVisibility() == VISIBLE;
        mStatusBarWindowController.setBubblesShowing(hasBubblesShowing);
        if (mStateChangeListener != null && hadBubbles != hasBubblesShowing) {
            mStateChangeListener.onHasBubblesChanged(hasBubblesShowing);
+0 −8
Original line number Diff line number Diff line
@@ -664,10 +664,6 @@ public class BubbleStackView extends FrameLayout {
        return mIsExpanded;
    }

    void runActionAfterTransientViewAnimations(Runnable after) {
        mStackAnimationController.runActionAfterAllViewsAndTransientRemoved(after);
    }

    /**
     * The {@link BubbleView} that is expanded, null if one does not exist.
     */
@@ -698,10 +694,6 @@ public class BubbleStackView extends FrameLayout {
        }
    }

    boolean hasTransientBubbles() {
        return mBubbleContainer.getTransientViewCount() > 0;
    }

    // via BubbleData.Listener
    void addBubble(Bubble bubble) {
        if (DEBUG_BUBBLE_STACK_VIEW) {
+6 −32
Original line number Diff line number Diff line
@@ -144,11 +144,6 @@ public class StackAnimationController extends
     */
    private boolean mFirstBubbleSpringingToTouch = false;

    /**
     * Action to run after all views, including transient views, have been removed from the layout.
     */
    @Nullable private Runnable mAfterAllViewsAndTransientRemoved = null;

    /** Horizontal offset of bubbles in the stack. */
    private float mStackOffset;
    /** Diameter of the bubble icon. */
@@ -565,14 +560,6 @@ public class StackAnimationController extends
                });
    }

    /**
     * Sets an action to run after all views, including transient views, have been removed from the
     * layout.
     */
    public void runActionAfterAllViewsAndTransientRemoved(Runnable action) {
        mAfterAllViewsAndTransientRemoved = action;
    }

    /**
     * Springs the first bubble to the given final position, with the rest of the stack 'following'.
     */
@@ -660,26 +647,13 @@ public class StackAnimationController extends

    @Override
    void onChildRemoved(View child, int index, Runnable finishRemoval) {
        // Animate the removing view in the opposite direction of the stack.
        final float xOffset = getOffsetForChainedPropertyAnimation(DynamicAnimation.TRANSLATION_X);
        animationForChild(child)
                .alpha(0f,
                        finishRemoval /* after */,
                        () -> {
                            // If this was the last transient view, run the callback.
                            if (mLayout.getTransientViewCount() == 0
                                    && mAfterAllViewsAndTransientRemoved != null) {

                                // If a 'real' view was added while we were animating out, don't run
                                // the callback since all views haven't been removed.
                                if (mLayout.getChildCount() == 0) {
                                    mAfterAllViewsAndTransientRemoved.run();
                                }

                                mAfterAllViewsAndTransientRemoved = null;
                            }
                        } /* after */)
                .scaleX(0f)
                .scaleY(0f)
                .withStiffness(ANIMATE_IN_STIFFNESS)
                .alpha(0f, finishRemoval /* after */)
                .scaleX(ANIMATE_IN_STARTING_SCALE)
                .scaleY(ANIMATE_IN_STARTING_SCALE)
                .translationX(mStackPosition.x - (-xOffset * ANIMATE_TRANSLATION_FACTOR))
                .start();

        if (mLayout.getChildCount() > 0) {