Merge "Fix issues with bubbles crashing/removing during expansion." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7bf84ecb6a
@@ -1554,6 +1554,14 @@ public class BubbleStackView extends FrameLayout
|
|||||||
mBubbleData.setShowingOverflow(true);
|
mBubbleData.setShowingOverflow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mIsExpanded && mIsExpansionAnimating) {
|
||||||
|
// If the bubble selection changed during the expansion animation, the expanding bubble
|
||||||
|
// probably crashed or immediately removed itself (or, we just got unlucky with a new
|
||||||
|
// auto-expanding bubble showing up at just the right time). Cancel the animations so we
|
||||||
|
// can start fresh.
|
||||||
|
cancelAllExpandCollapseSwitchAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
// If we're expanded, screenshot the currently expanded bubble (before expanding the newly
|
// If we're expanded, screenshot the currently expanded bubble (before expanding the newly
|
||||||
// selected bubble) so we can animate it out.
|
// selected bubble) so we can animate it out.
|
||||||
if (mIsExpanded && mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
|
if (mIsExpanded && mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
|
||||||
@@ -1879,35 +1887,37 @@ public class BubbleStackView extends FrameLayout
|
|||||||
mExpandedBubble.getExpandedView().setSurfaceZOrderedOnTop(false);
|
mExpandedBubble.getExpandedView().setSurfaceZOrderedOnTop(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDelayedAnimationHandler.postDelayed(() ->
|
mDelayedAnimationHandler.postDelayed(() -> {
|
||||||
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix)
|
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix).cancel();
|
||||||
.spring(AnimatableScaleMatrix.SCALE_X,
|
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix)
|
||||||
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(1f),
|
.spring(AnimatableScaleMatrix.SCALE_X,
|
||||||
mScaleInSpringConfig)
|
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(1f),
|
||||||
.spring(AnimatableScaleMatrix.SCALE_Y,
|
mScaleInSpringConfig)
|
||||||
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(1f),
|
.spring(AnimatableScaleMatrix.SCALE_Y,
|
||||||
mScaleInSpringConfig)
|
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(1f),
|
||||||
.addUpdateListener((target, values) -> {
|
mScaleInSpringConfig)
|
||||||
if (mExpandedBubble.getIconView() == null) {
|
.addUpdateListener((target, values) -> {
|
||||||
return;
|
if (mExpandedBubble.getIconView() == null) {
|
||||||
}
|
return;
|
||||||
mExpandedViewContainerMatrix.postTranslate(
|
}
|
||||||
mExpandedBubble.getIconView().getTranslationX()
|
mExpandedViewContainerMatrix.postTranslate(
|
||||||
- bubbleWillBeAtX,
|
mExpandedBubble.getIconView().getTranslationX()
|
||||||
0);
|
- bubbleWillBeAtX,
|
||||||
mExpandedViewContainer.setAnimationMatrix(
|
0);
|
||||||
mExpandedViewContainerMatrix);
|
mExpandedViewContainer.setAnimationMatrix(
|
||||||
})
|
mExpandedViewContainerMatrix);
|
||||||
.withEndActions(() -> {
|
})
|
||||||
if (mExpandedBubble != null
|
.withEndActions(() -> {
|
||||||
&& mExpandedBubble.getExpandedView() != null) {
|
if (mExpandedBubble != null
|
||||||
mExpandedBubble.getExpandedView()
|
&& mExpandedBubble.getExpandedView() != null) {
|
||||||
.setContentVisibility(true);
|
mExpandedBubble.getExpandedView()
|
||||||
mExpandedBubble.getExpandedView()
|
.setContentVisibility(true);
|
||||||
.setSurfaceZOrderedOnTop(false);
|
mExpandedBubble.getExpandedView()
|
||||||
}
|
.setSurfaceZOrderedOnTop(false);
|
||||||
})
|
}
|
||||||
.start(), startDelay);
|
})
|
||||||
|
.start();
|
||||||
|
}, startDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animateCollapse() {
|
private void animateCollapse() {
|
||||||
@@ -2035,6 +2045,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix).cancel();
|
||||||
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix)
|
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix)
|
||||||
.spring(AnimatableScaleMatrix.SCALE_X,
|
.spring(AnimatableScaleMatrix.SCALE_X,
|
||||||
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(1f),
|
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(1f),
|
||||||
@@ -2068,6 +2079,15 @@ public class BubbleStackView extends FrameLayout
|
|||||||
mIsBubbleSwitchAnimating = false;
|
mIsBubbleSwitchAnimating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cancelAllExpandCollapseSwitchAnimations() {
|
||||||
|
cancelDelayedExpandCollapseSwitchAnimations();
|
||||||
|
|
||||||
|
PhysicsAnimator.getInstance(mAnimatingOutSurfaceView).cancel();
|
||||||
|
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix).cancel();
|
||||||
|
|
||||||
|
mExpandedViewContainer.setAnimationMatrix(null);
|
||||||
|
}
|
||||||
|
|
||||||
private void notifyExpansionChanged(BubbleViewProvider bubble, boolean expanded) {
|
private void notifyExpansionChanged(BubbleViewProvider bubble, boolean expanded) {
|
||||||
if (mExpandListener != null && bubble != null) {
|
if (mExpandListener != null && bubble != null) {
|
||||||
mExpandListener.onBubbleExpandChanged(expanded, bubble.getKey());
|
mExpandListener.onBubbleExpandChanged(expanded, bubble.getKey());
|
||||||
@@ -2587,6 +2607,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
bev.setContentVisibility(false);
|
bev.setContentVisibility(false);
|
||||||
mExpandedViewContainerMatrix.setScaleX(0f);
|
mExpandedViewContainerMatrix.setScaleX(0f);
|
||||||
mExpandedViewContainerMatrix.setScaleY(0f);
|
mExpandedViewContainerMatrix.setScaleY(0f);
|
||||||
|
mExpandedViewContainerMatrix.setTranslate(0f, 0f);
|
||||||
mExpandedViewContainer.setVisibility(View.INVISIBLE);
|
mExpandedViewContainer.setVisibility(View.INVISIBLE);
|
||||||
mExpandedViewContainer.setAlpha(0f);
|
mExpandedViewContainer.setAlpha(0f);
|
||||||
mExpandedViewContainer.addView(bev);
|
mExpandedViewContainer.addView(bev);
|
||||||
|
|||||||
@@ -237,6 +237,10 @@ public class ExpandedAnimationController
|
|||||||
}
|
}
|
||||||
|
|
||||||
mAfterExpand = null;
|
mAfterExpand = null;
|
||||||
|
|
||||||
|
// Update bubble positions in case any bubbles were added or removed during the
|
||||||
|
// expansion animation.
|
||||||
|
updateBubblePositions();
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
after = () -> {
|
after = () -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user