Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt +10 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.media.taptotransfer.receiver import android.app.StatusBarManager import com.android.systemui.dagger.SysUISingleton import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.media.taptotransfer.common.MediaTttLoggerUtils import com.android.systemui.temporarydisplay.TemporaryViewLogger import javax.inject.Inject Loading Loading @@ -50,6 +51,15 @@ constructor( MediaTttLoggerUtils.logPackageNotFound(buffer, TAG, packageName) } fun logRippleAnimationEnd(id: Int) { buffer.log( tag, LogLevel.DEBUG, { int1 = id }, { "ripple animation for view with id: $int1 is ended" } ) } companion object { private const val TAG = "MediaTttReceiver" } Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class MediaTttReceiverRippleController constructor( private val context: Context, private val windowManager: WindowManager, private val mediaTttReceiverLogger: MediaTttReceiverLogger, ) { private var maxRippleWidth: Float = 0f Loading Loading @@ -90,12 +91,12 @@ constructor( /** Expands the ripple to cover the screen. */ fun expandToSuccessState(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable?) { layoutRipple(rippleView, isFullScreen = true) rippleView.expandToFull(maxRippleHeight, onAnimationEnd) rippleView.expandToFull(maxRippleHeight, mediaTttReceiverLogger, onAnimationEnd) } /** Collapses the ripple. */ fun collapseRipple(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable? = null) { rippleView.collapseRipple(onAnimationEnd) rippleView.collapseRipple(mediaTttReceiverLogger, onAnimationEnd) } private fun layoutRipple(rippleView: ReceiverChipRippleView, isFullScreen: Boolean = false) { Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt +29 −16 Original line number Diff line number Diff line Loading @@ -24,9 +24,7 @@ import com.android.systemui.surfaceeffects.ripple.RippleShader import com.android.systemui.surfaceeffects.ripple.RippleView import kotlin.math.pow /** * An expanding ripple effect for the media tap-to-transfer receiver chip. */ /** An expanding ripple effect for the media tap-to-transfer receiver chip. */ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleView(context, attrs) { // Indicates whether the ripple started expanding. Loading @@ -46,24 +44,34 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } /** Used to animate out the ripple. No-op if the ripple was never started via [startRipple]. */ fun collapseRipple(onAnimationEnd: Runnable? = null) { fun collapseRipple(logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null) { if (!isStarted) { return // Ignore if ripple is not started yet. } duration = DEFAULT_DURATION // Reset all listeners to animator. animator.removeAllListeners() animator.addListener(object : AnimatorListenerAdapter() { animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) } onAnimationEnd?.run() isStarted = false } }) } ) animator.reverse() } // Expands the ripple to cover full screen. fun expandToFull(newHeight: Float, onAnimationEnd: Runnable? = null) { fun expandToFull( newHeight: Float, logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null ) { if (!isStarted) { return } Loading @@ -85,13 +93,18 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi rippleShader.time = now.toFloat() invalidate() } animator.addListener(object : AnimatorListenerAdapter() { animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE } animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) } onAnimationEnd?.run() isStarted = false } }) } ) animator.start() } Loading Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt +10 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.media.taptotransfer.receiver import android.app.StatusBarManager import com.android.systemui.dagger.SysUISingleton import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.media.taptotransfer.common.MediaTttLoggerUtils import com.android.systemui.temporarydisplay.TemporaryViewLogger import javax.inject.Inject Loading Loading @@ -50,6 +51,15 @@ constructor( MediaTttLoggerUtils.logPackageNotFound(buffer, TAG, packageName) } fun logRippleAnimationEnd(id: Int) { buffer.log( tag, LogLevel.DEBUG, { int1 = id }, { "ripple animation for view with id: $int1 is ended" } ) } companion object { private const val TAG = "MediaTttReceiver" } Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class MediaTttReceiverRippleController constructor( private val context: Context, private val windowManager: WindowManager, private val mediaTttReceiverLogger: MediaTttReceiverLogger, ) { private var maxRippleWidth: Float = 0f Loading Loading @@ -90,12 +91,12 @@ constructor( /** Expands the ripple to cover the screen. */ fun expandToSuccessState(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable?) { layoutRipple(rippleView, isFullScreen = true) rippleView.expandToFull(maxRippleHeight, onAnimationEnd) rippleView.expandToFull(maxRippleHeight, mediaTttReceiverLogger, onAnimationEnd) } /** Collapses the ripple. */ fun collapseRipple(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable? = null) { rippleView.collapseRipple(onAnimationEnd) rippleView.collapseRipple(mediaTttReceiverLogger, onAnimationEnd) } private fun layoutRipple(rippleView: ReceiverChipRippleView, isFullScreen: Boolean = false) { Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt +29 −16 Original line number Diff line number Diff line Loading @@ -24,9 +24,7 @@ import com.android.systemui.surfaceeffects.ripple.RippleShader import com.android.systemui.surfaceeffects.ripple.RippleView import kotlin.math.pow /** * An expanding ripple effect for the media tap-to-transfer receiver chip. */ /** An expanding ripple effect for the media tap-to-transfer receiver chip. */ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleView(context, attrs) { // Indicates whether the ripple started expanding. Loading @@ -46,24 +44,34 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } /** Used to animate out the ripple. No-op if the ripple was never started via [startRipple]. */ fun collapseRipple(onAnimationEnd: Runnable? = null) { fun collapseRipple(logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null) { if (!isStarted) { return // Ignore if ripple is not started yet. } duration = DEFAULT_DURATION // Reset all listeners to animator. animator.removeAllListeners() animator.addListener(object : AnimatorListenerAdapter() { animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) } onAnimationEnd?.run() isStarted = false } }) } ) animator.reverse() } // Expands the ripple to cover full screen. fun expandToFull(newHeight: Float, onAnimationEnd: Runnable? = null) { fun expandToFull( newHeight: Float, logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null ) { if (!isStarted) { return } Loading @@ -85,13 +93,18 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi rippleShader.time = now.toFloat() invalidate() } animator.addListener(object : AnimatorListenerAdapter() { animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE } animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) } onAnimationEnd?.run() isStarted = false } }) } ) animator.start() } Loading