From e1e5f29d68844a503f22bae7ae5067652e471bd1 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Tue, 17 Jan 2023 11:02:23 +0100 Subject: [PATCH] Improve animation from keyguard shortcut This CL improves the activity launch animations from keyguard shortcuts by changing their background to be a rounded rectangle instead of an oval, so that it can be properly animated during the launch, and by adding support for StateListDrawable in GhostedViewLaunchAnimatorController. See b/265280100#comment6 for a video. Bug: 265280100 Test: Launch an activity from a keyguard shortcut Change-Id: Id22045a64a062ebea5be5adebda667f4616f0597 --- .../GhostedViewLaunchAnimatorController.kt | 5 ++++ .../keyguard_bottom_affordance_bg.xml | 23 +++++++++++-------- .../SystemUI/res/values-sw600dp/dimens.xml | 4 ---- packages/SystemUI/res/values/dimens.xml | 4 +--- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt index dfac02d99c4df..24413c0076fab 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt @@ -26,6 +26,7 @@ import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable import android.graphics.drawable.InsetDrawable import android.graphics.drawable.LayerDrawable +import android.graphics.drawable.StateListDrawable import android.util.Log import android.view.GhostView import android.view.View @@ -341,6 +342,10 @@ open class GhostedViewLaunchAnimatorController @JvmOverloads constructor( } } + if (drawable is StateListDrawable) { + return findGradientDrawable(drawable.current) + } + return null } } diff --git a/packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml b/packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml index 18fcebbb65a00..dfb73a905f0a9 100644 --- a/packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml +++ b/packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml @@ -27,22 +27,26 @@ android:top="3dp" android:right="3dp" android:bottom="3dp"> - + + + + android:width="@dimen/keyguard_affordance_fixed_width" + android:height="@dimen/keyguard_affordance_fixed_height"/> + - + + android:width="@dimen/keyguard_affordance_fixed_width" + android:height="@dimen/keyguard_affordance_fixed_height"/> + @@ -55,11 +59,12 @@ android:top="3dp" android:right="3dp" android:bottom="3dp"> - + + android:width="@dimen/keyguard_affordance_fixed_width" + android:height="@dimen/keyguard_affordance_fixed_height"/> + diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 9bc0dde49b4c8..db7fb48a4ac44 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -30,10 +30,6 @@ 24dp - - 80dp - 120dp - 400dp diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 890d96444b048..c2a40abfebd93 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -762,12 +762,10 @@ 200dp - 48dp - 48dp - 48dp 48dp 24dp + 8dp