From 3ca10a1325f2db21185d6143d310f55056865f05 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. 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 ed2d18a243..545a94d641 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); }