From f2e2e77dec04684380beab2878677aed459c0c28 Mon Sep 17 00:00:00 2001 From: Marvin Bernal Date: Sat, 29 Apr 2023 02:00:09 +0000 Subject: Animate Back arrow pop off edge consistently Previously velocity was taken into account but a predetermined pop animation based on transition is used for simplification Bug: 280119431 Test: Manual Change-Id: I4412722d20ce8401d1a9a892bde82beee17bd2a7 --- .../navigationbar/gestural/BackPanelController.kt | 24 +++++++++------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanelController.kt b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanelController.kt index 91bb7898494f..edab56e8d9b9 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanelController.kt +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanelController.kt @@ -71,10 +71,9 @@ private const val MIN_DURATION_INACTIVE_TO_ACTIVE_CONSIDERED_AS_FLING = 400L private const val POP_ON_FLING_DELAY = 60L private const val POP_ON_FLING_VELOCITY = 2f private const val POP_ON_COMMITTED_VELOCITY = 3f -private const val POP_ON_ACTIVE_MAX_VELOCITY = 2.5f -private const val POP_ON_ACTIVE_MIN_VELOCITY = 4.5f -private const val POP_ON_INACTIVE_MAX_VELOCITY = -1.05f -private const val POP_ON_INACTIVE_MIN_VELOCITY = -1.5f +private const val POP_ON_ENTRY_TO_ACTIVE_VELOCITY = 4.5f +private const val POP_ON_INACTIVE_TO_ACTIVE_VELOCITY = 4.7f +private const val POP_ON_INACTIVE_VELOCITY = -1.5f internal val VIBRATE_ACTIVATED_EFFECT = VibrationEffect.createPredefined(VibrationEffect.EFFECT_CLICK) @@ -916,11 +915,12 @@ class BackPanelController internal constructor( mainHandler.postDelayed(10L) { vibratorHelper.vibrate(VIBRATE_ACTIVATED_EFFECT) } - val startingVelocity = convertVelocityToAnimationFactor( - valueOnFastVelocity = POP_ON_ACTIVE_MAX_VELOCITY, - valueOnSlowVelocity = POP_ON_ACTIVE_MIN_VELOCITY, - ) - mView.popOffEdge(startingVelocity) + val popVelocity = if (previousState == GestureState.INACTIVE) { + POP_ON_INACTIVE_TO_ACTIVE_VELOCITY + } else { + POP_ON_ENTRY_TO_ACTIVE_VELOCITY + } + mView.popOffEdge(popVelocity) } GestureState.INACTIVE -> { @@ -933,11 +933,7 @@ class BackPanelController internal constructor( // so that gesture progress in this state is consistent regardless of entry totalTouchDeltaInactive = params.deactivationTriggerThreshold - val startingVelocity = convertVelocityToAnimationFactor( - valueOnFastVelocity = POP_ON_INACTIVE_MAX_VELOCITY, - valueOnSlowVelocity = POP_ON_INACTIVE_MIN_VELOCITY - ) - mView.popOffEdge(startingVelocity) + mView.popOffEdge(POP_ON_INACTIVE_VELOCITY) vibratorHelper.vibrate(VIBRATE_DEACTIVATED_EFFECT) updateRestingArrowDimens() -- cgit v1.2.3-59-g8ed1b