diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java index 009114ffa0be..d8b32500db85 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java @@ -61,7 +61,8 @@ public class BubbleFlyoutView extends FrameLayout { /** Translation Y of fade animation. */ private static final float FLYOUT_FADE_Y = 40f; - private static final long FLYOUT_FADE_DURATION = 200L; + private static final long FLYOUT_FADE_OUT_DURATION = 150L; + private static final long FLYOUT_FADE_IN_DURATION = 250L; private final int mFlyoutPadding; private final int mFlyoutSpaceFromBubble; @@ -235,26 +236,32 @@ public class BubbleFlyoutView extends FrameLayout { * Fade animation for consecutive flyouts. */ void animateUpdate(Bubble.FlyoutMessage flyoutMessage, float parentWidth, float stackY) { - fade(false /* in */); - updateFlyoutMessage(flyoutMessage, parentWidth); - // Wait for TextViews to layout with updated height. - post(() -> { - mFlyoutY = stackY + (mBubbleSize - mFlyoutTextContainer.getHeight()) / 2f; - fade(true /* in */); - }); + 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 */); + } /* after */ ); + }; + fade(false /* in */, afterFadeOut); } - private void fade(boolean in) { + /* + * Fade-out above or fade-in from below. + */ + private void fade(boolean in, Runnable afterFade) { setAlpha(in ? 0f : 1f); - setTranslationY(in ? mFlyoutY : mFlyoutY + FLYOUT_FADE_Y); + setTranslationY(in ? mFlyoutY + FLYOUT_FADE_Y : mFlyoutY); animate() .alpha(in ? 1f : 0f) - .setDuration(FLYOUT_FADE_DURATION) + .setDuration(in ? FLYOUT_FADE_IN_DURATION : FLYOUT_FADE_OUT_DURATION) .setInterpolator(in ? ALPHA_IN : ALPHA_OUT); animate() .translationY(in ? mFlyoutY : mFlyoutY - FLYOUT_FADE_Y) - .setDuration(FLYOUT_FADE_DURATION) - .setInterpolator(in ? ALPHA_IN : ALPHA_OUT); + .setDuration(in ? FLYOUT_FADE_IN_DURATION : FLYOUT_FADE_OUT_DURATION) + .setInterpolator(in ? ALPHA_IN : ALPHA_OUT) + .withEndAction(afterFade); } private void updateFlyoutMessage(Bubble.FlyoutMessage flyoutMessage, float parentWidth) { |