From 8c68088b6704623e8849d9c085e251fc08bdb941 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Thu, 2 Dec 2021 13:07:43 +0100 Subject: [PATCH] Change DialogLaunchAnimator X-axis interpolator This dialog changes the interpolator used to animate the X-axis position of dialogs during the launch animation. This avoid animating the dialog out of the screen bounds (see b/208241926#comment1). Bug: 208241926 Test: Manual Change-Id: Ia5accb747615fcc8410b5c488ff13617556305be --- .../android/systemui/animation/DialogLaunchAnimator.kt | 8 +++++++- .../src/com/android/systemui/animation/LaunchAnimator.kt | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt index 1a6c66f383027..066e169dcde35 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt @@ -49,7 +49,13 @@ class DialogLaunchAnimator @JvmOverloads constructor( ) { private companion object { private val TIMINGS = ActivityLaunchAnimator.TIMINGS - private val INTERPOLATORS = ActivityLaunchAnimator.INTERPOLATORS + + // We use the same interpolator for X and Y axis to make sure the dialog does not move out + // of the screen bounds during the animation. + private val INTERPOLATORS = ActivityLaunchAnimator.INTERPOLATORS.copy( + positionXInterpolator = ActivityLaunchAnimator.INTERPOLATORS.positionInterpolator + ) + private val TAG_LAUNCH_ANIMATION_RUNNING = R.id.launch_animation_running } diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/LaunchAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/LaunchAnimator.kt index fbd09c03afd7e..ebe96ebf29889 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/LaunchAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/LaunchAnimator.kt @@ -172,7 +172,7 @@ class LaunchAnimator( ) /** The interpolators used by this animator. */ - class Interpolators( + data class Interpolators( /** The interpolator used for the Y position, width, height and corner radius. */ val positionInterpolator: Interpolator,