Reset the bubble bar scale when the animation is interrupted
Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 381283214
Test: atest BubbleBarViewAnimatorTest
Test: manual
- have a bubble in the bubble bar
- launch an app
- set animator scale to 5x to slow down animation
- send a bubble
- when the bubble bar animates interrupt the animation by
touching the bubble bar
- observe the bubble bar scale is reset correctly
Change-Id: I1abd81e3df987ba749a13eb1b7506d5c1d8fdddd
This commit is contained in:
+11
-7
@@ -511,23 +511,21 @@ constructor(
|
||||
|
||||
/** Interrupts the animation due to touching the bubble bar or flyout. */
|
||||
fun interruptForTouch() {
|
||||
animatingBubble?.hideAnimation?.let { scheduler.cancel(it) }
|
||||
PhysicsAnimator.getInstance(bubbleBarView).cancelIfRunning()
|
||||
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
|
||||
cancelFlyout()
|
||||
val hideAnimation = animatingBubble?.hideAnimation ?: return
|
||||
scheduler.cancel(hideAnimation)
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
resetBubbleBarPropertiesOnInterrupt()
|
||||
clearAnimatingBubble()
|
||||
}
|
||||
|
||||
/** Notifies the animator that the taskbar area was touched during an animation. */
|
||||
fun onStashStateChangingWhileAnimating() {
|
||||
animatingBubble?.hideAnimation?.let { scheduler.cancel(it) }
|
||||
cancelFlyout()
|
||||
val hideAnimation = animatingBubble?.hideAnimation ?: return
|
||||
scheduler.cancel(hideAnimation)
|
||||
clearAnimatingBubble()
|
||||
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
resetBubbleBarPropertiesOnInterrupt()
|
||||
bubbleStashController.onNewBubbleAnimationInterrupted(
|
||||
/* isStashed= */ bubbleBarView.alpha == 0f,
|
||||
bubbleBarView.translationY,
|
||||
@@ -541,7 +539,7 @@ constructor(
|
||||
scheduler.cancel(hideAnimation)
|
||||
animatingBubble = null
|
||||
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
resetBubbleBarPropertiesOnInterrupt()
|
||||
// stash the bubble bar since the IME is now visible
|
||||
bubbleStashController.onNewBubbleAnimationInterrupted(
|
||||
/* isStashed= */ true,
|
||||
@@ -679,6 +677,12 @@ constructor(
|
||||
bubbleStashController.showBubbleBarImmediate()
|
||||
}
|
||||
|
||||
private fun resetBubbleBarPropertiesOnInterrupt() {
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
bubbleBarView.scaleX = 1f
|
||||
bubbleBarView.scaleY = 1f
|
||||
}
|
||||
|
||||
private fun <T> PhysicsAnimator<T>?.cancelIfRunning() {
|
||||
if (this?.isRunning() == true) cancel()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user