From 7146fc249f3ba7ba7fc8674ecc86ab3e8a756d33 Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Thu, 31 Aug 2023 23:08:54 +0000 Subject: [PATCH] Ensure Gesture Nav Edu animation scales to fit different screen sizes The lottie animation in the gesture nav tutorial wasn't scaling correctly for certain devices leading to gaps around the animation. This change uses animation's scale transformation to ensure it fits the dimensions of the device. Flag: ENABLE_NEW_GESTURE_NAV_TUTORIAL Fix: 295809541 Test: Went through the tutorial on different types of devices and ensure the animation takes up the entire screen. (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3ca10a1325f2db21185d6143d310f55056865f05) Merged-In: Iadee0d0389a11aa38c9e947b4b40466acd8f4422 Change-Id: Iadee0d0389a11aa38c9e947b4b40466acd8f4422 --- .../android/quickstep/interaction/TutorialController.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java index 4a1fec3ecf..139083b074 100644 --- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java @@ -226,13 +226,11 @@ abstract class TutorialController implements BackGestureAttemptCallback, return; } Matrix scaleMatrix = new Matrix(); - float pivotX = mScreenWidth / 2f; - float pivotY = mScreenHeight; float scaleFactor = mScreenWidth / animationBoundsRect.width(); + float heightTranslate = (mScreenHeight - (scaleFactor * animationBoundsRect.height())); - scaleMatrix.postScale(scaleFactor, scaleFactor, pivotX, pivotY); - scaleMatrix.postTranslate(0, - mTutorialFragment.getDeviceProfile().heightPx - animationBoundsRect.height()); + scaleMatrix.postScale(scaleFactor, scaleFactor); + scaleMatrix.postTranslate(0, heightTranslate); mAnimatedGestureDemonstration.setImageMatrix(scaleMatrix); }