diff options
author | Tony Wickham <twickham@google.com> | 2019-11-01 15:53:52 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2019-11-01 15:53:52 -0700 |
commit | 6894f4f1bb833822f335a01191cae2dfcf604fbc (patch) | |
tree | 12e97ffe6d2722bece96400f245b0e453ce6e44a /src | |
parent | 23df556ec40b096eb562503ebe25f12adf0305c3 (diff) | |
download | android_packages_apps_Trebuchet-6894f4f1bb833822f335a01191cae2dfcf604fbc.tar.gz android_packages_apps_Trebuchet-6894f4f1bb833822f335a01191cae2dfcf604fbc.tar.bz2 android_packages_apps_Trebuchet-6894f4f1bb833822f335a01191cae2dfcf604fbc.zip |
Fix issue where popup jumps to full size before closing
Some background on what was happening:
- When mEndRect.isEmpty(), we set it to (0, 0 , width, height)
- We called mEndRect.setEmpty() in animateClose(), but override
mEndRect if the reveal animation set the outline bounds.
- But the reveal animation doesn't set the outline bounds until
after the arrow animation (40ms) finishes, i.e. the arrow scales
up for 40ms then we clip to outline and start revealing the popup
- Thus, if you started a drag before the arrow animation finished,
we called mEndRect.setEmpty(), which made the close animation start
from the full popup size even though it was previously invisible.
To fix this, we clip the popup to its (empty) outline while the
arrow animates in, and then we can always start from wherever the
outline currently is when we close the popup.
Test:
- Set animation duration to 10x
- Long press an icon, and start dragging before the arrow scale
animation finishes
- The popup never shows, whereas before it jumped to full size
Bug: 143639898
Change-Id: I284dd06a23e0e9c3faf066a0083ac13bac88ebcc
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/popup/ArrowPopup.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java index 28000b977..98f7fd853 100644 --- a/src/com/android/launcher3/popup/ArrowPopup.java +++ b/src/com/android/launcher3/popup/ArrowPopup.java @@ -360,10 +360,14 @@ public abstract class ArrowPopup extends AbstractFloatingView { final TimeInterpolator revealInterpolator = ACCEL_DEACCEL; // Rectangular reveal. + mEndRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); final ValueAnimator revealAnim = createOpenCloseOutlineProvider() .createRevealAnimator(this, false); revealAnim.setDuration(revealDuration); revealAnim.setInterpolator(revealInterpolator); + // Clip the popup to the initial outline while the notification dot and arrow animate. + revealAnim.start(); + revealAnim.pause(); ValueAnimator fadeIn = ValueAnimator.ofFloat(0, 1); fadeIn.setDuration(revealDuration + arrowDuration); @@ -399,7 +403,6 @@ public abstract class ArrowPopup extends AbstractFloatingView { if (!mIsOpen) { return; } - mEndRect.setEmpty(); if (getOutlineProvider() instanceof RevealOutlineAnimation) { ((RevealOutlineAnimation) getOutlineProvider()).getOutline(mEndRect); } @@ -471,9 +474,6 @@ public abstract class ArrowPopup extends AbstractFloatingView { mStartRect.set(arrowCenterX - halfArrowWidth, arrowCenterY, arrowCenterX + halfArrowWidth, arrowCenterY); - if (mEndRect.isEmpty()) { - mEndRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); - } return new RoundedRectRevealOutlineProvider (arrowCornerRadius, mOutlineRadius, mStartRect, mEndRect); |