Loading packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationConfig.kt +3 −9 Original line number Diff line number Diff line Loading @@ -19,17 +19,11 @@ data class RippleAnimationConfig( val maxHeight: Float = 0f, val pixelDensity: Float = 1f, var color: Int = Color.WHITE, val opacity: Int = RIPPLE_DEFAULT_ALPHA, val sparkleStrength: Float = RIPPLE_SPARKLE_STRENGTH, val opacity: Int = RippleShader.RIPPLE_DEFAULT_ALPHA, val sparkleStrength: Float = RippleShader.RIPPLE_SPARKLE_STRENGTH, // Null means it uses default fade parameter values. val baseRingFadeParams: RippleShader.FadeParams? = null, val sparkleRingFadeParams: RippleShader.FadeParams? = null, val centerFillFadeParams: RippleShader.FadeParams? = null, val shouldDistort: Boolean = true ) { companion object { const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f const val RIPPLE_DEFAULT_COLOR: Int = 0xffffffff.toInt() const val RIPPLE_DEFAULT_ALPHA: Int = 115 // full opacity is 255. } } ) packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleShader.kt +4 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,10 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : const val DEFAULT_CENTER_FILL_FADE_OUT_START = 0f const val DEFAULT_CENTER_FILL_FADE_OUT_END = 0.6f const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f const val RIPPLE_DEFAULT_COLOR: Int = 0xffffffff.toInt() const val RIPPLE_DEFAULT_ALPHA: Int = 115 // full opacity is 255. private const val SHADER_UNIFORMS = """ uniform vec2 in_center; Loading packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt +3 −3 Original line number Diff line number Diff line Loading @@ -72,9 +72,9 @@ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, a this.rippleShape = rippleShape rippleShader = RippleShader(rippleShape) rippleShader.color = RippleAnimationConfig.RIPPLE_DEFAULT_COLOR rippleShader.color = RippleShader.RIPPLE_DEFAULT_COLOR rippleShader.rawProgress = 0f rippleShader.sparkleStrength = RippleAnimationConfig.RIPPLE_SPARKLE_STRENGTH rippleShader.sparkleStrength = RippleShader.RIPPLE_SPARKLE_STRENGTH rippleShader.pixelDensity = resources.displayMetrics.density ripplePaint.shader = rippleShader Loading Loading @@ -209,7 +209,7 @@ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, a * * 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) { fun setColor(color: Int, alpha: Int = RippleShader.RIPPLE_DEFAULT_ALPHA) { rippleShader.color = ColorUtils.setAlphaComponent(color, alpha) } Loading packages/SystemUI/src/com/android/systemui/charging/WirelessChargingLayout.java +1 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; import com.android.systemui.shared.recents.utilities.Utilities; import com.android.systemui.surfaceeffects.ripple.RippleAnimationConfig; import com.android.systemui.surfaceeffects.ripple.RippleShader; import com.android.systemui.surfaceeffects.ripple.RippleShader.RippleShape; import com.android.systemui.surfaceeffects.ripple.RippleView; Loading Loading @@ -177,7 +176,7 @@ final class WirelessChargingLayout extends FrameLayout { mRippleView.setBlur(6.5f, 2.5f); } else { mRippleView.setDuration(CIRCLE_RIPPLE_ANIMATION_DURATION); mRippleView.setColor(color, RippleAnimationConfig.RIPPLE_DEFAULT_ALPHA); mRippleView.setColor(color, RippleShader.RIPPLE_DEFAULT_ALPHA); } OnAttachStateChangeListener listener = new OnAttachStateChangeListener() { Loading Loading
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleAnimationConfig.kt +3 −9 Original line number Diff line number Diff line Loading @@ -19,17 +19,11 @@ data class RippleAnimationConfig( val maxHeight: Float = 0f, val pixelDensity: Float = 1f, var color: Int = Color.WHITE, val opacity: Int = RIPPLE_DEFAULT_ALPHA, val sparkleStrength: Float = RIPPLE_SPARKLE_STRENGTH, val opacity: Int = RippleShader.RIPPLE_DEFAULT_ALPHA, val sparkleStrength: Float = RippleShader.RIPPLE_SPARKLE_STRENGTH, // Null means it uses default fade parameter values. val baseRingFadeParams: RippleShader.FadeParams? = null, val sparkleRingFadeParams: RippleShader.FadeParams? = null, val centerFillFadeParams: RippleShader.FadeParams? = null, val shouldDistort: Boolean = true ) { companion object { const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f const val RIPPLE_DEFAULT_COLOR: Int = 0xffffffff.toInt() const val RIPPLE_DEFAULT_ALPHA: Int = 115 // full opacity is 255. } } )
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleShader.kt +4 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,10 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : const val DEFAULT_CENTER_FILL_FADE_OUT_START = 0f const val DEFAULT_CENTER_FILL_FADE_OUT_END = 0.6f const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f const val RIPPLE_DEFAULT_COLOR: Int = 0xffffffff.toInt() const val RIPPLE_DEFAULT_ALPHA: Int = 115 // full opacity is 255. private const val SHADER_UNIFORMS = """ uniform vec2 in_center; Loading
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt +3 −3 Original line number Diff line number Diff line Loading @@ -72,9 +72,9 @@ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, a this.rippleShape = rippleShape rippleShader = RippleShader(rippleShape) rippleShader.color = RippleAnimationConfig.RIPPLE_DEFAULT_COLOR rippleShader.color = RippleShader.RIPPLE_DEFAULT_COLOR rippleShader.rawProgress = 0f rippleShader.sparkleStrength = RippleAnimationConfig.RIPPLE_SPARKLE_STRENGTH rippleShader.sparkleStrength = RippleShader.RIPPLE_SPARKLE_STRENGTH rippleShader.pixelDensity = resources.displayMetrics.density ripplePaint.shader = rippleShader Loading Loading @@ -209,7 +209,7 @@ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, a * * 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) { fun setColor(color: Int, alpha: Int = RippleShader.RIPPLE_DEFAULT_ALPHA) { rippleShader.color = ColorUtils.setAlphaComponent(color, alpha) } Loading
packages/SystemUI/src/com/android/systemui/charging/WirelessChargingLayout.java +1 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; import com.android.systemui.shared.recents.utilities.Utilities; import com.android.systemui.surfaceeffects.ripple.RippleAnimationConfig; import com.android.systemui.surfaceeffects.ripple.RippleShader; import com.android.systemui.surfaceeffects.ripple.RippleShader.RippleShape; import com.android.systemui.surfaceeffects.ripple.RippleView; Loading Loading @@ -177,7 +176,7 @@ final class WirelessChargingLayout extends FrameLayout { mRippleView.setBlur(6.5f, 2.5f); } else { mRippleView.setDuration(CIRCLE_RIPPLE_ANIMATION_DURATION); mRippleView.setColor(color, RippleAnimationConfig.RIPPLE_DEFAULT_ALPHA); mRippleView.setColor(color, RippleShader.RIPPLE_DEFAULT_ALPHA); } OnAttachStateChangeListener listener = new OnAttachStateChangeListener() { Loading