From 190eb078c83d9cc267e8617fa56226a52d2876fb Mon Sep 17 00:00:00 2001 From: Michael Mikhail Date: Wed, 15 Mar 2023 01:12:01 +0000 Subject: [PATCH] [Media TTT] Draw ripple before translation In some devices, we notice a change in the translation amount of icon ripple compared to the receiver icon. To make sure the ripple icon is drawn behind the receiver icon before any translation occurs. Bug: 273500887 Test: Checked the ui on tablet device. Check the video in bug link. Change-Id: I86f741ef6209867967e1d463f4f2d39b3bf28661 --- .../receiver/MediaTttChipControllerReceiver.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt index fab8c068b2a75..78082c3eb3c63 100644 --- a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt +++ b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt @@ -225,8 +225,10 @@ open class MediaTttChipControllerReceiver @Inject constructor( val iconRippleView: ReceiverChipRippleView = view.requireViewById(R.id.icon_glow_ripple) val rippleView: ReceiverChipRippleView = view.requireViewById(R.id.ripple) val translationYBy = getTranslationAmount() + // Expand ripple before translating icon container to make sure both views have same bounds. + rippleController.expandToInProgressState(rippleView, iconRippleView) // Make the icon container view starts animation from bottom of the screen. - iconContainerView.translationY += rippleController.getReceiverIconSize() + iconContainerView.translationY = rippleController.getReceiverIconSize().toFloat() animateViewTranslationAndFade( iconContainerView, translationYBy = -1 * translationYBy, @@ -235,7 +237,6 @@ open class MediaTttChipControllerReceiver @Inject constructor( ) { animateBouncingView(iconContainerView, translationYBy * BOUNCE_TRANSLATION_RATIO) } - rippleController.expandToInProgressState(rippleView, iconRippleView) } override fun animateViewOut(view: ViewGroup, removalReason: String?, onAnimationEnd: Runnable) { @@ -293,7 +294,7 @@ open class MediaTttChipControllerReceiver @Inject constructor( /** Returns the amount that the chip will be translated by in its intro animation. */ private fun getTranslationAmount(): Float { - return rippleController.getRippleSize() * 0.5f + return rippleController.getReceiverIconSize() * 2f } private fun View.getAppIconView(): CachingIconView {