diff options
| author | 2021-06-23 15:39:20 -0400 | |
|---|---|---|
| committer | 2021-06-23 15:52:47 -0400 | |
| commit | f2c1c3cba8acf04bbf5fe89758f926767589045c (patch) | |
| tree | ede5807b556271026e030708a721756059f6efa5 | |
| parent | a389edcf517e769c06542f775796088098d62631 (diff) | |
Fix screenshot to corner animation
We now offset the location of the screenshot preview based on its
location in the screen, but we were setting the scale in between
making the "location in window" and "location in screen"
measurements, which meant that the preview got offset to the wrong
place.
This change moves any changes to the actual views into the
onAnimationStart method, to logically separate the animation setup
calculations from the animation itself.
Bug: 191894245
Fix: 191894245
Test: manual
Change-Id: Idc3d7654268d277f7416a025952ee6654e1a0630
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java index 669046591170..3c830cc374ab 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java @@ -453,14 +453,6 @@ public class ScreenshotView extends FrameLayout implements mCornerSizeX / (mOrientationPortrait ? bounds.width() : bounds.height()); final float currentScale = 1 / cornerScale; - mScreenshotPreview.setScaleX(currentScale); - mScreenshotPreview.setScaleY(currentScale); - - if (mAccessibilityManager.isEnabled()) { - mDismissButton.setAlpha(0); - mDismissButton.setVisibility(View.VISIBLE); - } - AnimatorSet dropInAnimation = new AnimatorSet(); ValueAnimator flashInAnimator = ValueAnimator.ofFloat(0, 1); flashInAnimator.setDuration(SCREENSHOT_FLASH_IN_DURATION_MS); @@ -491,6 +483,20 @@ public class ScreenshotView extends FrameLayout implements ValueAnimator toCorner = ValueAnimator.ofFloat(0, 1); toCorner.setDuration(SCREENSHOT_TO_CORNER_Y_DURATION_MS); + + toCorner.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + mScreenshotPreview.setScaleX(currentScale); + mScreenshotPreview.setScaleY(currentScale); + mScreenshotPreview.setVisibility(View.VISIBLE); + if (mAccessibilityManager.isEnabled()) { + mDismissButton.setAlpha(0); + mDismissButton.setVisibility(View.VISIBLE); + } + } + }); + float xPositionPct = SCREENSHOT_TO_CORNER_X_DURATION_MS / (float) SCREENSHOT_TO_CORNER_Y_DURATION_MS; float dismissPct = @@ -534,13 +540,6 @@ public class ScreenshotView extends FrameLayout implements } }); - toCorner.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - mScreenshotPreview.setVisibility(View.VISIBLE); - } - }); - mScreenshotFlash.setAlpha(0f); mScreenshotFlash.setVisibility(View.VISIBLE); |