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

Commit 47e6644a authored by Marvin Bernal's avatar Marvin Bernal Committed by Automerger Merge Worker
Browse files

Merge "Back Arrow tweak slow swipe and fling animation" into udc-dev am: bd48c206 am: 6e3bb67d

parents c9d049a7 6e3bb67d
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -363,12 +363,8 @@ class BackPanel(
    }

    fun popOffEdge(startingVelocity: Float) {
        val heightStretchAmount = startingVelocity * 50
        val widthStretchAmount = startingVelocity * 150
        val scaleStretchAmount = startingVelocity * 0.8f
        backgroundHeight.stretchTo(stretchAmount = 0f, startingVelocity = -heightStretchAmount)
        backgroundWidth.stretchTo(stretchAmount = 0f, startingVelocity = widthStretchAmount)
        scale.stretchTo(stretchAmount = 0f, startingVelocity = -scaleStretchAmount)
        scale.stretchTo(stretchAmount = 0f, startingVelocity = startingVelocity * -.8f)
        horizontalTranslation.stretchTo(stretchAmount = 0f, startingVelocity * 200f)
    }

    fun popScale(startingVelocity: Float) {
@@ -410,7 +406,7 @@ class BackPanel(
        arrowAlpha.updateRestingPosition(restingParams.arrowDimens.alpha, animate)
        arrowLength.updateRestingPosition(restingParams.arrowDimens.length, animate)
        arrowHeight.updateRestingPosition(restingParams.arrowDimens.height, animate)
        scalePivotX.updateRestingPosition(restingParams.backgroundDimens.width, animate)
        scalePivotX.updateRestingPosition(restingParams.scalePivotX, animate)
        backgroundWidth.updateRestingPosition(restingParams.backgroundDimens.width, animate)
        backgroundHeight.updateRestingPosition(restingParams.backgroundDimens.height, animate)
        backgroundEdgeCornerRadius.updateRestingPosition(
+8 −5
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import kotlin.math.sign

private const val TAG = "BackPanelController"
private const val ENABLE_FAILSAFE = true
private const val FAILSAFE_DELAY_MS = 350L

private const val PX_PER_SEC = 1000
private const val PX_PER_MS = 1
@@ -64,9 +65,9 @@ private const val MIN_DURATION_FLING_ANIMATION = 160L
private const val MIN_DURATION_ENTRY_TO_ACTIVE_CONSIDERED_AS_FLING = 100L
private const val MIN_DURATION_INACTIVE_TO_ACTIVE_CONSIDERED_AS_FLING = 400L

private const val FAILSAFE_DELAY_MS = 350L
private const val POP_ON_FLING_DELAY = 50L
private const val POP_ON_FLING_SCALE = 3f
private const val POP_ON_FLING_DELAY = 60L
private const val POP_ON_FLING_SCALE = 2f
private const val POP_ON_COMMITTED_SCALE = 3f

internal val VIBRATE_ACTIVATED_EFFECT =
        VibrationEffect.createPredefined(VibrationEffect.EFFECT_CLICK)
@@ -774,7 +775,9 @@ class BackPanelController internal constructor(
                            GestureState.ENTRY,
                            GestureState.INACTIVE,
                            GestureState.CANCELLED -> params.preThresholdIndicator.scalePivotX
                            else -> params.committedIndicator.scalePivotX
                            GestureState.ACTIVE -> params.activeIndicator.scalePivotX
                            GestureState.FLUNG,
                            GestureState.COMMITTED -> params.committedIndicator.scalePivotX
                        },
                        horizontalTranslation = when (currentState) {
                            GestureState.GONE -> {
@@ -921,7 +924,7 @@ class BackPanelController internal constructor(
                    mainHandler.postDelayed(onEndSetGoneStateListener.runnable,
                            MIN_DURATION_COMMITTED_AFTER_FLING_ANIMATION)
                } else {
                    mView.popScale(POP_ON_FLING_SCALE)
                    mView.popScale(POP_ON_COMMITTED_SCALE)
                    mainHandler.postDelayed(onAlphaEndSetGoneStateListener.runnable,
                            MIN_DURATION_COMMITTED_ANIMATION)
                }
+4 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ data class EdgePanelParams(private var resources: Resources) {
    data class BackIndicatorDimens(
            val horizontalTranslation: Float? = 0f,
            val scale: Float = 0f,
            val scalePivotX: Float = 0f,
            val scalePivotX: Float? = null,
            val arrowDimens: ArrowDimens,
            val backgroundDimens: BackgroundDimens,
            val verticalTranslationSpring: SpringForce? = null,
@@ -203,7 +203,8 @@ data class EdgePanelParams(private var resources: Resources) {
                horizontalTranslation = getDimen(R.dimen.navigation_edge_active_margin),
                scale = getDimenFloat(R.dimen.navigation_edge_active_scale),
                horizontalTranslationSpring = entryActiveHorizontalTranslationSpring,
                scaleSpring = createSpring(450f, 0.415f),
                scaleSpring = createSpring(450f, 0.39f),
                scalePivotX = getDimen(R.dimen.navigation_edge_active_background_width),
                arrowDimens = ArrowDimens(
                        length = getDimen(R.dimen.navigation_edge_active_arrow_length),
                        height = getDimen(R.dimen.navigation_edge_active_arrow_height),
@@ -258,6 +259,7 @@ data class EdgePanelParams(private var resources: Resources) {

        committedIndicator = activeIndicator.copy(
                horizontalTranslation = null,
                scalePivotX = null,
                arrowDimens = activeIndicator.arrowDimens.copy(
                        lengthSpring = activeCommittedArrowLengthSpring,
                        heightSpring = activeCommittedArrowHeightSpring,