Merge changes I6129aff7,I7e21ee87 into sc-dev

* changes:
  Fix dot & badge being on correct side for the first bubble added
  Fix the dot not showing when it should
This commit is contained in:
Mady Mellor
2021-06-08 21:16:42 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 13 deletions

View File

@@ -231,7 +231,8 @@ public class BubbleFlyoutView extends FrameLayout {
* Fade animation for consecutive flyouts. * Fade animation for consecutive flyouts.
*/ */
void animateUpdate(Bubble.FlyoutMessage flyoutMessage, float parentWidth, PointF stackPos, void animateUpdate(Bubble.FlyoutMessage flyoutMessage, float parentWidth, PointF stackPos,
boolean hideDot) { boolean hideDot, Runnable onHide) {
mOnHide = onHide;
final Runnable afterFadeOut = () -> { final Runnable afterFadeOut = () -> {
updateFlyoutMessage(flyoutMessage, parentWidth); updateFlyoutMessage(flyoutMessage, parentWidth);
// Wait for TextViews to layout with updated height. // Wait for TextViews to layout with updated height.

View File

@@ -1492,22 +1492,22 @@ public class BubbleStackView extends FrameLayout
mStackAnimationController.setStackPosition(mPositioner.getDefaultStartPosition()); mStackAnimationController.setStackPosition(mPositioner.getDefaultStartPosition());
} }
if (getBubbleCount() == 0) {
mStackOnLeftOrWillBe = mStackAnimationController.isStackOnLeftSide();
}
if (bubble.getIconView() == null) { if (bubble.getIconView() == null) {
return; return;
} }
mBubbleContainer.addView(bubble.getIconView(), 0,
new FrameLayout.LayoutParams(mPositioner.getBubbleSize(),
mPositioner.getBubbleSize()));
if (getBubbleCount() == 0) {
mStackOnLeftOrWillBe = mStackAnimationController.isStackOnLeftSide();
}
// Set the dot position to the opposite of the side the stack is resting on, since the stack // Set the dot position to the opposite of the side the stack is resting on, since the stack
// resting slightly off-screen would result in the dot also being off-screen. // resting slightly off-screen would result in the dot also being off-screen.
bubble.getIconView().setDotBadgeOnLeft(!mStackOnLeftOrWillBe /* onLeft */); bubble.getIconView().setDotBadgeOnLeft(!mStackOnLeftOrWillBe /* onLeft */);
bubble.getIconView().setOnClickListener(mBubbleClickListener); bubble.getIconView().setOnClickListener(mBubbleClickListener);
bubble.getIconView().setOnTouchListener(mBubbleTouchListener); bubble.getIconView().setOnTouchListener(mBubbleTouchListener);
mBubbleContainer.addView(bubble.getIconView(), 0,
new FrameLayout.LayoutParams(mPositioner.getBubbleSize(),
mPositioner.getBubbleSize()));
updateBubbleShadows(false /* showForAllBubbles */); updateBubbleShadows(false /* showForAllBubbles */);
animateInFlyoutForBubble(bubble); animateInFlyoutForBubble(bubble);
requestUpdate(); requestUpdate();
@@ -2400,7 +2400,8 @@ public class BubbleStackView extends FrameLayout
if (mFlyout.getVisibility() == View.VISIBLE) { if (mFlyout.getVisibility() == View.VISIBLE) {
mFlyout.animateUpdate(bubble.getFlyoutMessage(), getWidth(), mFlyout.animateUpdate(bubble.getFlyoutMessage(), getWidth(),
mStackAnimationController.getStackPosition(), !bubble.showDot()); mStackAnimationController.getStackPosition(), !bubble.showDot(),
mAfterFlyoutHidden /* onHide */);
} else { } else {
mFlyout.setVisibility(INVISIBLE); mFlyout.setVisibility(INVISIBLE);
mFlyout.setupFlyoutStartingAsDot(bubble.getFlyoutMessage(), mFlyout.setupFlyoutStartingAsDot(bubble.getFlyoutMessage(),
@@ -2408,7 +2409,7 @@ public class BubbleStackView extends FrameLayout
mStackAnimationController.isStackOnLeftSide(), mStackAnimationController.isStackOnLeftSide(),
bubble.getIconView().getDotColor() /* dotColor */, bubble.getIconView().getDotColor() /* dotColor */,
expandFlyoutAfterDelay /* onLayoutComplete */, expandFlyoutAfterDelay /* onLayoutComplete */,
mAfterFlyoutHidden, mAfterFlyoutHidden /* onHide */,
bubble.getIconView().getDotCenter(), bubble.getIconView().getDotCenter(),
!bubble.showDot(), !bubble.showDot(),
mPositioner); mPositioner);

View File

@@ -124,9 +124,6 @@ public class StackAnimationController extends
*/ */
private Rect mAnimatingToBounds = new Rect(); private Rect mAnimatingToBounds = new Rect();
/** Initial starting location for the stack. */
@Nullable private BubbleStackView.RelativeStackPosition mStackStartPosition;
/** Whether or not the stack's start position has been set. */ /** Whether or not the stack's start position has been set. */
private boolean mStackMovedToStartPosition = false; private boolean mStackMovedToStartPosition = false;