Loading packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt +15 −14 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.widget.FrameLayout import com.android.systemui.R import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider import com.android.systemui.statusbar.window.StatusBarWindowController import com.android.systemui.util.animation.AnimationUtil.Companion.frames import javax.inject.Inject import kotlin.math.roundToInt Loading Loading @@ -109,14 +110,14 @@ class SystemEventChipAnimationController @Inject constructor( initializeAnimRect() val alphaIn = ValueAnimator.ofFloat(0f, 1f).apply { startDelay = 117 duration = 83 startDelay = 7.frames duration = 5.frames interpolator = null addUpdateListener { currentAnimatedView?.view?.alpha = animatedValue as Float } } val moveIn = ValueAnimator.ofInt(chipMinWidth, chipWidth).apply { startDelay = 117 duration = 383 startDelay = 7.frames duration = 23.frames interpolator = STATUS_BAR_X_MOVE_IN addUpdateListener { updateAnimatedViewBoundsWidth(animatedValue as Int) Loading Loading @@ -146,7 +147,7 @@ class SystemEventChipAnimationController @Inject constructor( private fun createMoveOutAnimationForDot(): Animator { val width1 = ValueAnimator.ofInt(chipWidth, chipMinWidth).apply { duration = 150 duration = 9.frames interpolator = STATUS_CHIP_WIDTH_TO_DOT_KEYFRAME_1 addUpdateListener { updateAnimatedViewBoundsWidth(it.animatedValue as Int) Loading @@ -154,8 +155,8 @@ class SystemEventChipAnimationController @Inject constructor( } val width2 = ValueAnimator.ofInt(chipMinWidth, dotSize).apply { startDelay = 150 duration = 333 startDelay = 9.frames duration = 20.frames interpolator = STATUS_CHIP_WIDTH_TO_DOT_KEYFRAME_2 addUpdateListener { updateAnimatedViewBoundsWidth(it.animatedValue as Int) Loading @@ -167,8 +168,8 @@ class SystemEventChipAnimationController @Inject constructor( val chipVerticalCenter = v.top + v.measuredHeight / 2 val height1 = ValueAnimator.ofInt( currentAnimatedView!!.view.measuredHeight, keyFrame1Height).apply { startDelay = 133 duration = 100 startDelay = 8.frames duration = 6.frames interpolator = STATUS_CHIP_HEIGHT_TO_DOT_KEYFRAME_1 addUpdateListener { updateAnimatedViewBoundsHeight(it.animatedValue as Int, chipVerticalCenter) Loading @@ -176,8 +177,8 @@ class SystemEventChipAnimationController @Inject constructor( } val height2 = ValueAnimator.ofInt(keyFrame1Height, dotSize).apply { startDelay = 233 duration = 250 startDelay = 14.frames duration = 15.frames interpolator = STATUS_CHIP_HEIGHT_TO_DOT_KEYFRAME_2 addUpdateListener { updateAnimatedViewBoundsHeight(it.animatedValue as Int, chipVerticalCenter) Loading @@ -187,8 +188,8 @@ class SystemEventChipAnimationController @Inject constructor( // Move the chip view to overlap exactly with the privacy dot. The chip displays by default // exactly adjacent to the dot, so we can just move over by the diameter of the dot itself val moveOut = ValueAnimator.ofInt(0, dotSize).apply { startDelay = 50 duration = 183 startDelay = 3.frames duration = 11.frames interpolator = STATUS_CHIP_MOVE_TO_DOT addUpdateListener { // If RTL, we can just invert the move Loading @@ -208,7 +209,7 @@ class SystemEventChipAnimationController @Inject constructor( private fun createMoveOutAnimationDefault(): Animator { val moveOut = ValueAnimator.ofInt(chipWidth, chipMinWidth).apply { duration = 383 duration = 23.frames addUpdateListener { currentAnimatedView?.apply { updateAnimatedViewBoundsWidth(it.animatedValue as Int) Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarSystemEventAnimator.kt +7 −6 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.R import com.android.systemui.statusbar.events.STATUS_BAR_X_MOVE_IN import com.android.systemui.statusbar.events.STATUS_BAR_X_MOVE_OUT import com.android.systemui.statusbar.events.SystemStatusAnimationCallback import com.android.systemui.util.animation.AnimationUtil.Companion.frames /** * Tied directly to [SystemStatusAnimationScheduler]. Any StatusBar-like thing (keyguard, collapsed Loading @@ -45,12 +46,12 @@ class StatusBarSystemEventAnimator( R.dimen.ongoing_appops_chip_animation_out_status_bar_translation_x) override fun onSystemEventAnimationBegin(): Animator { val moveOut = ValueAnimator.ofFloat(0f, 1f).setDuration(383) val moveOut = ValueAnimator.ofFloat(0f, 1f).setDuration(23.frames) moveOut.interpolator = STATUS_BAR_X_MOVE_OUT moveOut.addUpdateListener { animation: ValueAnimator -> animatedView.translationX = -(translationXIn * animation.animatedValue as Float) } val alphaOut = ValueAnimator.ofFloat(1f, 0f).setDuration(133) val alphaOut = ValueAnimator.ofFloat(1f, 0f).setDuration(8.frames) alphaOut.interpolator = null alphaOut.addUpdateListener { animation: ValueAnimator -> animatedView.alpha = animation.animatedValue as Float Loading @@ -63,14 +64,14 @@ class StatusBarSystemEventAnimator( override fun onSystemEventAnimationFinish(hasPersistentDot: Boolean): Animator { animatedView.translationX = translationXOut.toFloat() val moveIn = ValueAnimator.ofFloat(1f, 0f).setDuration(467) moveIn.startDelay = 33 val moveIn = ValueAnimator.ofFloat(1f, 0f).setDuration(28.frames) moveIn.startDelay = 2.frames moveIn.interpolator = STATUS_BAR_X_MOVE_IN moveIn.addUpdateListener { animation: ValueAnimator -> animatedView.translationX = translationXOut * animation.animatedValue as Float } val alphaIn = ValueAnimator.ofFloat(0f, 1f).setDuration(167) alphaIn.startDelay = 67 val alphaIn = ValueAnimator.ofFloat(0f, 1f).setDuration(10.frames) alphaIn.startDelay = 4.frames alphaIn.interpolator = null alphaIn.addUpdateListener { animation: ValueAnimator -> animatedView.alpha = animation.animatedValue as Float Loading packages/SystemUI/src/com/android/systemui/util/animation/AnimationUtil.kt +6 −0 Original line number Diff line number Diff line Loading @@ -37,5 +37,11 @@ class AnimationUtil { } return (numFrames * 1000f / 60f).roundToLong() } /** * Convenience extension function for [getMsForFrames], so that we can write `23.frames` */ val Int.frames: Long get() = getMsForFrames(this) } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt +15 −14 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.widget.FrameLayout import com.android.systemui.R import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider import com.android.systemui.statusbar.window.StatusBarWindowController import com.android.systemui.util.animation.AnimationUtil.Companion.frames import javax.inject.Inject import kotlin.math.roundToInt Loading Loading @@ -109,14 +110,14 @@ class SystemEventChipAnimationController @Inject constructor( initializeAnimRect() val alphaIn = ValueAnimator.ofFloat(0f, 1f).apply { startDelay = 117 duration = 83 startDelay = 7.frames duration = 5.frames interpolator = null addUpdateListener { currentAnimatedView?.view?.alpha = animatedValue as Float } } val moveIn = ValueAnimator.ofInt(chipMinWidth, chipWidth).apply { startDelay = 117 duration = 383 startDelay = 7.frames duration = 23.frames interpolator = STATUS_BAR_X_MOVE_IN addUpdateListener { updateAnimatedViewBoundsWidth(animatedValue as Int) Loading Loading @@ -146,7 +147,7 @@ class SystemEventChipAnimationController @Inject constructor( private fun createMoveOutAnimationForDot(): Animator { val width1 = ValueAnimator.ofInt(chipWidth, chipMinWidth).apply { duration = 150 duration = 9.frames interpolator = STATUS_CHIP_WIDTH_TO_DOT_KEYFRAME_1 addUpdateListener { updateAnimatedViewBoundsWidth(it.animatedValue as Int) Loading @@ -154,8 +155,8 @@ class SystemEventChipAnimationController @Inject constructor( } val width2 = ValueAnimator.ofInt(chipMinWidth, dotSize).apply { startDelay = 150 duration = 333 startDelay = 9.frames duration = 20.frames interpolator = STATUS_CHIP_WIDTH_TO_DOT_KEYFRAME_2 addUpdateListener { updateAnimatedViewBoundsWidth(it.animatedValue as Int) Loading @@ -167,8 +168,8 @@ class SystemEventChipAnimationController @Inject constructor( val chipVerticalCenter = v.top + v.measuredHeight / 2 val height1 = ValueAnimator.ofInt( currentAnimatedView!!.view.measuredHeight, keyFrame1Height).apply { startDelay = 133 duration = 100 startDelay = 8.frames duration = 6.frames interpolator = STATUS_CHIP_HEIGHT_TO_DOT_KEYFRAME_1 addUpdateListener { updateAnimatedViewBoundsHeight(it.animatedValue as Int, chipVerticalCenter) Loading @@ -176,8 +177,8 @@ class SystemEventChipAnimationController @Inject constructor( } val height2 = ValueAnimator.ofInt(keyFrame1Height, dotSize).apply { startDelay = 233 duration = 250 startDelay = 14.frames duration = 15.frames interpolator = STATUS_CHIP_HEIGHT_TO_DOT_KEYFRAME_2 addUpdateListener { updateAnimatedViewBoundsHeight(it.animatedValue as Int, chipVerticalCenter) Loading @@ -187,8 +188,8 @@ class SystemEventChipAnimationController @Inject constructor( // Move the chip view to overlap exactly with the privacy dot. The chip displays by default // exactly adjacent to the dot, so we can just move over by the diameter of the dot itself val moveOut = ValueAnimator.ofInt(0, dotSize).apply { startDelay = 50 duration = 183 startDelay = 3.frames duration = 11.frames interpolator = STATUS_CHIP_MOVE_TO_DOT addUpdateListener { // If RTL, we can just invert the move Loading @@ -208,7 +209,7 @@ class SystemEventChipAnimationController @Inject constructor( private fun createMoveOutAnimationDefault(): Animator { val moveOut = ValueAnimator.ofInt(chipWidth, chipMinWidth).apply { duration = 383 duration = 23.frames addUpdateListener { currentAnimatedView?.apply { updateAnimatedViewBoundsWidth(it.animatedValue as Int) Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarSystemEventAnimator.kt +7 −6 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.R import com.android.systemui.statusbar.events.STATUS_BAR_X_MOVE_IN import com.android.systemui.statusbar.events.STATUS_BAR_X_MOVE_OUT import com.android.systemui.statusbar.events.SystemStatusAnimationCallback import com.android.systemui.util.animation.AnimationUtil.Companion.frames /** * Tied directly to [SystemStatusAnimationScheduler]. Any StatusBar-like thing (keyguard, collapsed Loading @@ -45,12 +46,12 @@ class StatusBarSystemEventAnimator( R.dimen.ongoing_appops_chip_animation_out_status_bar_translation_x) override fun onSystemEventAnimationBegin(): Animator { val moveOut = ValueAnimator.ofFloat(0f, 1f).setDuration(383) val moveOut = ValueAnimator.ofFloat(0f, 1f).setDuration(23.frames) moveOut.interpolator = STATUS_BAR_X_MOVE_OUT moveOut.addUpdateListener { animation: ValueAnimator -> animatedView.translationX = -(translationXIn * animation.animatedValue as Float) } val alphaOut = ValueAnimator.ofFloat(1f, 0f).setDuration(133) val alphaOut = ValueAnimator.ofFloat(1f, 0f).setDuration(8.frames) alphaOut.interpolator = null alphaOut.addUpdateListener { animation: ValueAnimator -> animatedView.alpha = animation.animatedValue as Float Loading @@ -63,14 +64,14 @@ class StatusBarSystemEventAnimator( override fun onSystemEventAnimationFinish(hasPersistentDot: Boolean): Animator { animatedView.translationX = translationXOut.toFloat() val moveIn = ValueAnimator.ofFloat(1f, 0f).setDuration(467) moveIn.startDelay = 33 val moveIn = ValueAnimator.ofFloat(1f, 0f).setDuration(28.frames) moveIn.startDelay = 2.frames moveIn.interpolator = STATUS_BAR_X_MOVE_IN moveIn.addUpdateListener { animation: ValueAnimator -> animatedView.translationX = translationXOut * animation.animatedValue as Float } val alphaIn = ValueAnimator.ofFloat(0f, 1f).setDuration(167) alphaIn.startDelay = 67 val alphaIn = ValueAnimator.ofFloat(0f, 1f).setDuration(10.frames) alphaIn.startDelay = 4.frames alphaIn.interpolator = null alphaIn.addUpdateListener { animation: ValueAnimator -> animatedView.alpha = animation.animatedValue as Float Loading
packages/SystemUI/src/com/android/systemui/util/animation/AnimationUtil.kt +6 −0 Original line number Diff line number Diff line Loading @@ -37,5 +37,11 @@ class AnimationUtil { } return (numFrames * 1000f / 60f).roundToLong() } /** * Convenience extension function for [getMsForFrames], so that we can write `23.frames` */ val Int.frames: Long get() = getMsForFrames(this) } }