Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +4 −0 Original line number Diff line number Diff line Loading @@ -1822,6 +1822,10 @@ public class BubbleStackView extends FrameLayout mExpandedBubble.getExpandedView().hideImeIfVisible(); } // Let the expanded animation controller know that it shouldn't animate child adds/reorders // since we're about to animate collapsed. mExpandedAnimationController.notifyPreparingToCollapse(); final long startDelay = (long) (ExpandedAnimationController.EXPAND_COLLAPSE_TARGET_ANIM_DURATION * 0.6f); postDelayed(() -> mExpandedAnimationController.collapseBackToStack( Loading packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +43 −9 Original line number Diff line number Diff line Loading @@ -92,6 +92,14 @@ public class ExpandedAnimationController private int mScreenOrientation; private boolean mAnimatingExpand = false; /** * Whether we are animating other Bubbles UI elements out in preparation for a call to * {@link #collapseBackToStack}. If true, we won't animate bubbles in response to adds or * reorders. */ private boolean mPreparingToCollapse = false; private boolean mAnimatingCollapse = false; private @Nullable Runnable mAfterExpand; private Runnable mAfterCollapse; Loading Loading @@ -150,6 +158,7 @@ public class ExpandedAnimationController */ public void expandFromStack( @Nullable Runnable after, @Nullable Runnable leadBubbleEndAction) { mPreparingToCollapse = false; mAnimatingCollapse = false; mAnimatingExpand = true; mAfterExpand = after; Loading @@ -165,9 +174,20 @@ public class ExpandedAnimationController expandFromStack(after, null /* leadBubbleEndAction */); } /** * Sets that we're animating the stack collapsed, but haven't yet called * {@link #collapseBackToStack}. This will temporarily suspend animations for bubbles that are * added or re-ordered, since the upcoming collapse animation will handle positioning those * bubbles in the collapsed stack. */ public void notifyPreparingToCollapse() { mPreparingToCollapse = true; } /** Animate collapsing the bubbles back to their stacked position. */ public void collapseBackToStack(PointF collapsePoint, Runnable after) { mAnimatingExpand = false; mPreparingToCollapse = false; mAnimatingCollapse = true; mAfterCollapse = after; mCollapsePoint = collapsePoint; Loading Loading @@ -501,14 +521,20 @@ public class ExpandedAnimationController startOrUpdatePathAnimation(false /* expanding */); } else { child.setTranslationX(getBubbleLeft(index)); // If we're preparing to collapse, don't start animations since the collapse animation // will take over and animate the new bubble into the correct (stacked) position. if (!mPreparingToCollapse) { animationForChild(child) .translationY( getExpandedY() - mBubbleSizePx * ANIMATE_TRANSLATION_FACTOR, /* from */ getExpandedY() - mBubbleSizePx * ANIMATE_TRANSLATION_FACTOR, /* from */ getExpandedY() /* to */) .start(); updateBubblePositions(); } } } @Override void onChildRemoved(View child, int index, Runnable finishRemoval) { Loading @@ -532,12 +558,20 @@ public class ExpandedAnimationController @Override void onChildReordered(View child, int oldIndex, int newIndex) { updateBubblePositions(); if (mPreparingToCollapse) { // If a re-order is received while we're preparing to collapse, ignore it. Once started, // the collapse animation will animate all of the bubbles to their correct (stacked) // position. return; } // We expect reordering during collapse, since we'll put the last selected bubble on top. // Update the collapse animation so they end up in the right stacked positions. if (mAnimatingCollapse) { // If a re-order is received during collapse, update the animation so that the bubbles // end up in the correct (stacked) position. startOrUpdatePathAnimation(false /* expanding */); } else { // Otherwise, animate the bubbles around to reflect their new order. updateBubblePositions(); } } Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +4 −0 Original line number Diff line number Diff line Loading @@ -1822,6 +1822,10 @@ public class BubbleStackView extends FrameLayout mExpandedBubble.getExpandedView().hideImeIfVisible(); } // Let the expanded animation controller know that it shouldn't animate child adds/reorders // since we're about to animate collapsed. mExpandedAnimationController.notifyPreparingToCollapse(); final long startDelay = (long) (ExpandedAnimationController.EXPAND_COLLAPSE_TARGET_ANIM_DURATION * 0.6f); postDelayed(() -> mExpandedAnimationController.collapseBackToStack( Loading
packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +43 −9 Original line number Diff line number Diff line Loading @@ -92,6 +92,14 @@ public class ExpandedAnimationController private int mScreenOrientation; private boolean mAnimatingExpand = false; /** * Whether we are animating other Bubbles UI elements out in preparation for a call to * {@link #collapseBackToStack}. If true, we won't animate bubbles in response to adds or * reorders. */ private boolean mPreparingToCollapse = false; private boolean mAnimatingCollapse = false; private @Nullable Runnable mAfterExpand; private Runnable mAfterCollapse; Loading Loading @@ -150,6 +158,7 @@ public class ExpandedAnimationController */ public void expandFromStack( @Nullable Runnable after, @Nullable Runnable leadBubbleEndAction) { mPreparingToCollapse = false; mAnimatingCollapse = false; mAnimatingExpand = true; mAfterExpand = after; Loading @@ -165,9 +174,20 @@ public class ExpandedAnimationController expandFromStack(after, null /* leadBubbleEndAction */); } /** * Sets that we're animating the stack collapsed, but haven't yet called * {@link #collapseBackToStack}. This will temporarily suspend animations for bubbles that are * added or re-ordered, since the upcoming collapse animation will handle positioning those * bubbles in the collapsed stack. */ public void notifyPreparingToCollapse() { mPreparingToCollapse = true; } /** Animate collapsing the bubbles back to their stacked position. */ public void collapseBackToStack(PointF collapsePoint, Runnable after) { mAnimatingExpand = false; mPreparingToCollapse = false; mAnimatingCollapse = true; mAfterCollapse = after; mCollapsePoint = collapsePoint; Loading Loading @@ -501,14 +521,20 @@ public class ExpandedAnimationController startOrUpdatePathAnimation(false /* expanding */); } else { child.setTranslationX(getBubbleLeft(index)); // If we're preparing to collapse, don't start animations since the collapse animation // will take over and animate the new bubble into the correct (stacked) position. if (!mPreparingToCollapse) { animationForChild(child) .translationY( getExpandedY() - mBubbleSizePx * ANIMATE_TRANSLATION_FACTOR, /* from */ getExpandedY() - mBubbleSizePx * ANIMATE_TRANSLATION_FACTOR, /* from */ getExpandedY() /* to */) .start(); updateBubblePositions(); } } } @Override void onChildRemoved(View child, int index, Runnable finishRemoval) { Loading @@ -532,12 +558,20 @@ public class ExpandedAnimationController @Override void onChildReordered(View child, int oldIndex, int newIndex) { updateBubblePositions(); if (mPreparingToCollapse) { // If a re-order is received while we're preparing to collapse, ignore it. Once started, // the collapse animation will animate all of the bubbles to their correct (stacked) // position. return; } // We expect reordering during collapse, since we'll put the last selected bubble on top. // Update the collapse animation so they end up in the right stacked positions. if (mAnimatingCollapse) { // If a re-order is received during collapse, update the animation so that the bubbles // end up in the correct (stacked) position. startOrUpdatePathAnimation(false /* expanding */); } else { // Otherwise, animate the bubbles around to reflect their new order. updateBubblePositions(); } } Loading