Merge "Move surface effects package to AnimationLib." into tm-qpr-dev am: 31c7f600e1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20587929 Change-Id: If222a116b6ea98d58424cf96a8ce669e863ecf3d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -34,7 +34,12 @@ android_library {
|
|||||||
"res",
|
"res",
|
||||||
],
|
],
|
||||||
|
|
||||||
static_libs: ["androidx.core_core-animation-nodeps"],
|
static_libs: [
|
||||||
|
"PluginCoreLib",
|
||||||
|
"androidx.core_core-animation-nodeps",
|
||||||
|
"androidx.core_core-ktx",
|
||||||
|
"androidx.annotation_annotation",
|
||||||
|
],
|
||||||
|
|
||||||
manifest: "AndroidManifest.xml",
|
manifest: "AndroidManifest.xml",
|
||||||
kotlincflags: ["-Xjvm-default=all"],
|
kotlincflags: ["-Xjvm-default=all"],
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.graphics.Paint
|
|||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.annotation.VisibleForTesting
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A view that allows multiple ripples to play.
|
* A view that allows multiple ripples to play.
|
||||||
@@ -30,7 +31,8 @@ import android.view.View
|
|||||||
*/
|
*/
|
||||||
class MultiRippleView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
|
class MultiRippleView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
|
||||||
|
|
||||||
internal val ripples = ArrayList<RippleAnimation>()
|
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
|
||||||
|
val ripples = ArrayList<RippleAnimation>()
|
||||||
private val listeners = ArrayList<RipplesFinishedListener>()
|
private val listeners = ArrayList<RipplesFinishedListener>()
|
||||||
private val ripplePaint = Paint()
|
private val ripplePaint = Paint()
|
||||||
private var isWarningLogged = false
|
private var isWarningLogged = false
|
||||||
@@ -19,11 +19,13 @@ package com.android.systemui.surfaceeffects.ripple
|
|||||||
import android.animation.Animator
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorListenerAdapter
|
import android.animation.AnimatorListenerAdapter
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
|
import androidx.annotation.VisibleForTesting
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
|
||||||
/** A single ripple animation. */
|
/** A single ripple animation. */
|
||||||
class RippleAnimation(private val config: RippleAnimationConfig) {
|
class RippleAnimation(private val config: RippleAnimationConfig) {
|
||||||
internal val rippleShader: RippleShader = RippleShader(config.rippleShape)
|
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
|
||||||
|
val rippleShader: RippleShader = RippleShader(config.rippleShape)
|
||||||
private val animator: ValueAnimator = ValueAnimator.ofFloat(0f, 1f)
|
private val animator: ValueAnimator = ValueAnimator.ofFloat(0f, 1f)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -32,7 +32,7 @@ import com.android.systemui.surfaceeffects.shaderutil.ShaderUtilLibrary
|
|||||||
*
|
*
|
||||||
* Modeled after frameworks/base/graphics/java/android/graphics/drawable/RippleShader.java.
|
* Modeled after frameworks/base/graphics/java/android/graphics/drawable/RippleShader.java.
|
||||||
*/
|
*/
|
||||||
class RippleShader internal constructor(rippleShape: RippleShape = RippleShape.CIRCLE) :
|
class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) :
|
||||||
RuntimeShader(buildShader(rippleShape)) {
|
RuntimeShader(buildShader(rippleShape)) {
|
||||||
|
|
||||||
/** Shapes that the [RippleShader] supports. */
|
/** Shapes that the [RippleShader] supports. */
|
||||||
@@ -68,7 +68,7 @@ class TurbulenceNoiseView(context: Context?, attrs: AttributeSet?) : View(contex
|
|||||||
canvas.drawPaint(paint)
|
canvas.drawPaint(paint)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun play(config: TurbulenceNoiseAnimationConfig) {
|
fun play(config: TurbulenceNoiseAnimationConfig) {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
return // Ignore if the animation is playing.
|
return // Ignore if the animation is playing.
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user