summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Marvin Bernal <marvinbernal@google.com> 2023-05-03 17:14:02 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-05-03 17:14:02 +0000
commit5b18a9dffb828f18b1a29db098e56126d1a2ba6c (patch)
treec6173fcebdc4fac83ad0188a6c09b60cde572f05
parentefbf3c9e1d75d1589452a840980025cd1d4a673b (diff)
parentf2e2e77dec04684380beab2878677aed459c0c28 (diff)
Merge "Animate Back arrow pop off edge consistently" into udc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanelController.kt24
1 files 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()