Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a03b4a5 authored by Miranda Kephart's avatar Miranda Kephart Committed by Android (Google) Code Review
Browse files

Merge "Ensure screenshot dismissal velocity is never 0" into main

parents 380b4403 de7b75b4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -317,7 +317,7 @@ class ScreenshotAnimationController(
    }

    private fun getAdjustedVelocity(requestedVelocity: Float?): Float {
        return if (requestedVelocity == null) {
        return if (requestedVelocity == null || abs(requestedVelocity) < .005f) {
            val isLTR = view.resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_LTR
            // dismiss to the left in LTR locales, to the right in RTL
            if (isLTR) -MINIMUM_VELOCITY else MINIMUM_VELOCITY
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import kotlin.math.abs
class SwipeGestureListener(
    private val view: View,
    private val onDismiss: (Float?) -> Unit,
    private val onCancel: () -> Unit
    private val onCancel: () -> Unit,
) {
    private val velocityTracker = VelocityTracker.obtain()
    private val displayMetrics = view.resources.displayMetrics
@@ -54,9 +54,9 @@ class SwipeGestureListener(
                    onDismiss.invoke(xVelocity)
                    return true
                } else {
                    velocityTracker.clear()
                    onCancel.invoke()
                }
                velocityTracker.clear()
            }
            MotionEvent.ACTION_MOVE -> {
                velocityTracker.addMovement(ev)