Fix bubble flyout alignment for right-side stack
Fixes: 172490423
Test: send updates on left/right side in portrait/landscape
=> see that flyout is positioned correctly
Change-Id: I3dd84f467f17e8429a0ba2cc23f45e8c89474557
This commit is contained in:
@@ -227,24 +227,29 @@ public class BubbleFlyoutView extends FrameLayout {
|
||||
/*
|
||||
* Fade animation for consecutive flyouts.
|
||||
*/
|
||||
void animateUpdate(Bubble.FlyoutMessage flyoutMessage, float parentWidth, float stackY) {
|
||||
void animateUpdate(Bubble.FlyoutMessage flyoutMessage, float parentWidth, PointF stackPos) {
|
||||
final Runnable afterFadeOut = () -> {
|
||||
updateFlyoutMessage(flyoutMessage, parentWidth);
|
||||
// Wait for TextViews to layout with updated height.
|
||||
post(() -> {
|
||||
mFlyoutY = stackY + (mBubbleSize - mFlyoutTextContainer.getHeight()) / 2f;
|
||||
fade(true /* in */, () -> {} /* after */);
|
||||
fade(true /* in */, stackPos, () -> {} /* after */);
|
||||
} /* after */ );
|
||||
};
|
||||
fade(false /* in */, afterFadeOut);
|
||||
fade(false /* in */, stackPos, afterFadeOut);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fade-out above or fade-in from below.
|
||||
*/
|
||||
private void fade(boolean in, Runnable afterFade) {
|
||||
private void fade(boolean in, PointF stackPos, Runnable afterFade) {
|
||||
mFlyoutY = stackPos.y + (mBubbleSize - mFlyoutTextContainer.getHeight()) / 2f;
|
||||
|
||||
setAlpha(in ? 0f : 1f);
|
||||
setTranslationY(in ? mFlyoutY + FLYOUT_FADE_Y : mFlyoutY);
|
||||
mRestingTranslationX = mArrowPointingLeft
|
||||
? stackPos.x + mBubbleSize + mFlyoutSpaceFromBubble
|
||||
: stackPos.x - getWidth() - mFlyoutSpaceFromBubble;
|
||||
setTranslationX(mRestingTranslationX);
|
||||
animate()
|
||||
.alpha(in ? 1f : 0f)
|
||||
.setDuration(in ? FLYOUT_FADE_IN_DURATION : FLYOUT_FADE_OUT_DURATION)
|
||||
|
||||
@@ -2434,7 +2434,7 @@ public class BubbleStackView extends FrameLayout
|
||||
|
||||
if (mFlyout.getVisibility() == View.VISIBLE) {
|
||||
mFlyout.animateUpdate(bubble.getFlyoutMessage(), getWidth(),
|
||||
mStackAnimationController.getStackPosition().y);
|
||||
mStackAnimationController.getStackPosition());
|
||||
} else {
|
||||
mFlyout.setVisibility(INVISIBLE);
|
||||
mFlyout.setupFlyoutStartingAsDot(bubble.getFlyoutMessage(),
|
||||
|
||||
Reference in New Issue
Block a user