summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Miranda Kephart <mkephart@google.com> 2020-02-20 12:49:41 -0500
committer Miranda Kephart <mkephart@google.com> 2020-02-20 12:51:41 -0500
commit4f150e08536bd5a355319add2ac4ca772077931c (patch)
treea671de092135f961720078102f18d56a8fc2a60b
parenta6149521d37a49c0ce4951d01c424027620de440 (diff)
Fix screenshot motion spec anchor point
Moves the anchor point of the animation into the corner from the top left corner to the center. This fixes the issue where the preview appeared to move "up" before following the correct path. Bug: 149100933 Test: manual; changes animations only Change-Id: I45edf9a82db5f67efa129bdb8a0fd091189e7c7a
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index 9e1e347da5e0..f06cd54f7756 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -497,9 +497,9 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
flashOutAnimator.addUpdateListener(animation ->
mScreenshotFlash.setAlpha((float) animation.getAnimatedValue()));
- final PointF startPos = new PointF((float) bounds.left, (float) bounds.top);
- final PointF finalPos = new PointF(mScreenshotOffsetXPx,
- mDisplayMetrics.heightPixels - mScreenshotOffsetYPx - height * cornerScale);
+ final PointF startPos = new PointF(bounds.centerX(), bounds.centerY());
+ final PointF finalPos = new PointF(mScreenshotOffsetXPx + width * cornerScale / 2f,
+ mDisplayMetrics.heightPixels - mScreenshotOffsetYPx - height * cornerScale / 2f);
ValueAnimator toCorner = ValueAnimator.ofFloat(0, 1);
toCorner.setDuration(SCREENSHOT_TO_CORNER_Y_DURATION_MS);
@@ -517,11 +517,13 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
}
if (t < xPositionPct) {
- mScreenshotView.setX(MathUtils.lerp(
- startPos.x, finalPos.x, mFastOutSlowIn.getInterpolation(t / xPositionPct)));
+ float xCenter = MathUtils.lerp(startPos.x, finalPos.x,
+ mFastOutSlowIn.getInterpolation(t / xPositionPct));
+ mScreenshotView.setX(xCenter - width * mScreenshotView.getScaleX() / 2f);
}
- mScreenshotView.setY(MathUtils.lerp(
- startPos.y, finalPos.y, mFastOutSlowIn.getInterpolation(t)));
+ float yCenter = MathUtils.lerp(startPos.y, finalPos.y,
+ mFastOutSlowIn.getInterpolation(t));
+ mScreenshotView.setY(yCenter - height * mScreenshotView.getScaleY() / 2f);
});
toCorner.addListener(new AnimatorListenerAdapter() {