Loading packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleShader.kt +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : * (1.-sparkleRing) * in_fadeSparkle; float rippleInsideAlpha = (1.-inside) * in_fadeFill; float rippleRingAlpha = (1.-sparkleRing) * in_fadeRing * in_sparkle_strength; float rippleRingAlpha = (1.-sparkleRing) * in_fadeRing; float rippleAlpha = max(rippleInsideAlpha, rippleRingAlpha) * in_color.a; vec4 ripple = vec4(in_color.rgb, 1.0) * rippleAlpha; return mix(ripple, vec4(sparkle), sparkle * in_sparkle_strength); Loading packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt +0 −9 Original line number Diff line number Diff line Loading @@ -117,15 +117,6 @@ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, a rippleShader.color = ColorUtils.setAlphaComponent(color, alpha) } /** * Set whether the ripple should remain filled as the ripple expands. * * See [RippleShader.rippleFill]. */ fun setRippleFill(rippleFill: Boolean) { rippleShader.rippleFill = rippleFill } /** Set the intensity of the sparkles. */ fun setSparkleStrength(strength: Float) { rippleShader.sparkleStrength = strength Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt +28 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi init { setupShader(RippleShader.RippleShape.CIRCLE) setRippleFill(true) setupRippleFadeParams() setSparkleStrength(0f) isStarted = false } Loading Loading @@ -72,7 +72,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi animator.removeAllUpdateListeners() // Only show the outline as ripple expands and disappears when animation ends. setRippleFill(false) removeRippleFill() val startingPercentage = calculateStartingPercentage(newHeight) animator.duration = EXPAND_TO_FULL_DURATION Loading Loading @@ -103,6 +103,32 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi return 1 - remainingPercentage } private fun setupRippleFadeParams() { with(rippleShader) { // No fade out for the base ring. baseRingFadeParams.fadeOutStart = 1f baseRingFadeParams.fadeOutEnd = 1f // No fade in and outs for the center fill, as we always draw it. centerFillFadeParams.fadeInStart = 0f centerFillFadeParams.fadeInEnd = 0f centerFillFadeParams.fadeOutStart = 1f centerFillFadeParams.fadeOutEnd = 1f } } private fun removeRippleFill() { with(rippleShader) { baseRingFadeParams.fadeOutStart = RippleShader.DEFAULT_BASE_RING_FADE_OUT_START baseRingFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END centerFillFadeParams.fadeInStart = RippleShader.DEFAULT_FADE_IN_START centerFillFadeParams.fadeInEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_IN_END centerFillFadeParams.fadeOutStart = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_START centerFillFadeParams.fadeOutEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_END } } companion object { const val DEFAULT_DURATION = 333L const val EXPAND_TO_FULL_DURATION = 1000L Loading Loading
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleShader.kt +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : * (1.-sparkleRing) * in_fadeSparkle; float rippleInsideAlpha = (1.-inside) * in_fadeFill; float rippleRingAlpha = (1.-sparkleRing) * in_fadeRing * in_sparkle_strength; float rippleRingAlpha = (1.-sparkleRing) * in_fadeRing; float rippleAlpha = max(rippleInsideAlpha, rippleRingAlpha) * in_color.a; vec4 ripple = vec4(in_color.rgb, 1.0) * rippleAlpha; return mix(ripple, vec4(sparkle), sparkle * in_sparkle_strength); Loading
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt +0 −9 Original line number Diff line number Diff line Loading @@ -117,15 +117,6 @@ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, a rippleShader.color = ColorUtils.setAlphaComponent(color, alpha) } /** * Set whether the ripple should remain filled as the ripple expands. * * See [RippleShader.rippleFill]. */ fun setRippleFill(rippleFill: Boolean) { rippleShader.rippleFill = rippleFill } /** Set the intensity of the sparkles. */ fun setSparkleStrength(strength: Float) { rippleShader.sparkleStrength = strength Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt +28 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi init { setupShader(RippleShader.RippleShape.CIRCLE) setRippleFill(true) setupRippleFadeParams() setSparkleStrength(0f) isStarted = false } Loading Loading @@ -72,7 +72,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi animator.removeAllUpdateListeners() // Only show the outline as ripple expands and disappears when animation ends. setRippleFill(false) removeRippleFill() val startingPercentage = calculateStartingPercentage(newHeight) animator.duration = EXPAND_TO_FULL_DURATION Loading Loading @@ -103,6 +103,32 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi return 1 - remainingPercentage } private fun setupRippleFadeParams() { with(rippleShader) { // No fade out for the base ring. baseRingFadeParams.fadeOutStart = 1f baseRingFadeParams.fadeOutEnd = 1f // No fade in and outs for the center fill, as we always draw it. centerFillFadeParams.fadeInStart = 0f centerFillFadeParams.fadeInEnd = 0f centerFillFadeParams.fadeOutStart = 1f centerFillFadeParams.fadeOutEnd = 1f } } private fun removeRippleFill() { with(rippleShader) { baseRingFadeParams.fadeOutStart = RippleShader.DEFAULT_BASE_RING_FADE_OUT_START baseRingFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END centerFillFadeParams.fadeInStart = RippleShader.DEFAULT_FADE_IN_START centerFillFadeParams.fadeInEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_IN_END centerFillFadeParams.fadeOutStart = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_START centerFillFadeParams.fadeOutEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_END } } companion object { const val DEFAULT_DURATION = 333L const val EXPAND_TO_FULL_DURATION = 1000L Loading