mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Merge "Skip animation when clicking on menu action from App Chip Menu." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
eaa0136bba
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user