Merge "Skip animation when clicking on menu action from App Chip Menu." into main

This commit is contained in:
Treehugger Robot
2025-02-26 12:19:29 -08:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 10 deletions

View File

@@ -296,7 +296,7 @@ constructor(
fun getMenuTranslationY(): MultiPropertyFactory<View>.MultiProperty =
viewTranslationY[INDEX_MENU_TRANSLATION]
internal fun revealAnim(isRevealing: Boolean) {
internal fun revealAnim(isRevealing: Boolean, animated: Boolean = true) {
cancelInProgressAnimations()
val collapsedBackgroundBounds = getCollapsedBackgroundLtrBounds()
val expandedBackgroundBounds = getExpandedBackgroundLtrBounds()
@@ -392,6 +392,7 @@ constructor(
animator!!.setDuration(MENU_BACKGROUND_HIDE_DURATION.toLong())
}
if (!animated) animator!!.duration = 0
animator!!.interpolator = Interpolators.EMPHASIZED
animator!!.start()
}

View File

@@ -75,7 +75,7 @@ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int = 0) :
if (ev.action == MotionEvent.ACTION_DOWN) {
if (!recentsViewContainer.dragLayer.isEventOverView(this, ev)) {
// TODO: log this once we have a new container type for it?
close(true)
animateOpenOrClosed(true)
return true
}
}
@@ -83,7 +83,7 @@ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int = 0) :
}
override fun handleClose(animate: Boolean) {
animateClose()
animateOpenOrClosed(true, animated = false)
}
override fun isOfType(type: Int): Boolean = (type and TYPE_TASK_MENU) != 0
@@ -260,11 +260,7 @@ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int = 0) :
private val iconView: View
get() = taskContainer.iconView.asView()
private fun animateClose() {
animateOpenOrClosed(true)
}
private fun animateOpenOrClosed(closing: Boolean) {
private fun animateOpenOrClosed(closing: Boolean, animated: Boolean = true) {
openCloseAnimator?.let { if (it.isRunning) it.cancel() }
openCloseAnimator = AnimatorSet()
// If we're opening, we just start from the beginning as a new `TaskMenuView` is created
@@ -312,7 +308,12 @@ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int = 0) :
}
}
)
val animationDuration = if (closing) REVEAL_CLOSE_DURATION else REVEAL_OPEN_DURATION
val animationDuration =
when {
animated && closing -> REVEAL_CLOSE_DURATION
animated && !closing -> REVEAL_OPEN_DURATION
else -> 0L
}
openCloseAnimator!!.setDuration(animationDuration)
openCloseAnimator!!.start()
}

View File

@@ -1476,7 +1476,8 @@ constructor(
return if (enableOverviewIconMenu() && menuContainer.iconView is IconAppChipView) {
menuContainer.iconView.revealAnim(/* isRevealing= */ true)
TaskMenuView.showForTask(menuContainer) {
menuContainer.iconView.revealAnim(/* isRevealing= */ false)
val isAnimated = !recentsView.isSplitSelectionActive
menuContainer.iconView.revealAnim(/* isRevealing= */ false, isAnimated)
if (enableHoverOfChildElementsInTaskview()) {
recentsView.setTaskBorderEnabled(true)
}