From ce83d6a5d6c4756cc2b33e2139a87e902dfe48fe Mon Sep 17 00:00:00 2001 From: Yein Jo Date: Tue, 15 Nov 2022 05:28:03 +0000 Subject: [PATCH] Fix ripple opacity to match the previous config. the default opacity was 0.45 in the shader. the color utilities class that we use expects the alpha value in the range of 0-255, thus 0.45 should be mapped to 255*0.4=114.75 (which is roughly 115). please find the recordings in the bug linked! Bug: 259187018 Test: manual Change-Id: I355da98c3397cd760899b82442e7a07012b8b7f7 --- .../systemui/surfaceeffects/ripple/RippleAnimationConfig.kt | 2 +- .../com/android/systemui/surfaceeffects/ripple/RippleView.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationConfig.kt b/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationConfig.kt index ae73df201f8d1..773ac55130d4e 100644 --- a/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationConfig.kt +++ b/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationConfig.kt @@ -27,6 +27,6 @@ data class RippleAnimationConfig( companion object { const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f const val RIPPLE_DEFAULT_COLOR: Int = 0xffffffff.toInt() - const val RIPPLE_DEFAULT_ALPHA: Int = 45 // full opacity is 255. + const val RIPPLE_DEFAULT_ALPHA: Int = 115 // full opacity is 255. } } diff --git a/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt b/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt index 299469494295b..2ad8243487947 100644 --- a/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt +++ b/packages/SystemUI/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt @@ -111,7 +111,7 @@ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, a /** * Set the color to be used for the ripple. * - * The alpha value of the color will be applied to the ripple. The alpha range is [0-100]. + * The alpha value of the color will be applied to the ripple. The alpha range is [0-255]. */ fun setColor(color: Int, alpha: Int = RippleAnimationConfig.RIPPLE_DEFAULT_ALPHA) { rippleShader.color = ColorUtils.setAlphaComponent(color, alpha)