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

Commit 88109889 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez Committed by Android (Google) Code Review
Browse files

Merge "Comparing thresholds to the gesture directly." into main

parents bfcc91fe d3ea6676
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() {
            underTest.setMagneticRowTranslation(swipedRow, translation = 100f)

            // WHEN setting a translation that will fall below the threshold
            val translation = threshold / underTest.swipedRowMultiplier - 50f
            val translation = 50f
            underTest.setMagneticRowTranslation(swipedRow, translation)

            // THEN the targets continue to be pulled and translations are set
@@ -162,7 +162,7 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() {
            underTest.setMagneticRowTranslation(swipedRow, translation = 100f)

            // WHEN setting a translation that will fall below the threshold
            val translation = threshold / underTest.swipedRowMultiplier - 50f
            val translation = 50f
            underTest.setMagneticRowTranslation(swipedRow, translation)

            // THEN the targets continue to be pulled and reduced translations are set
@@ -185,7 +185,7 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() {
            underTest.setMagneticRowTranslation(swipedRow, translation = 100f)

            // WHEN setting a translation that will fall above the threshold
            val translation = threshold / underTest.swipedRowMultiplier + 50f
            val translation = 150f
            underTest.setMagneticRowTranslation(swipedRow, translation)

            // THEN the swiped view detaches and the correct detach haptics play
@@ -208,7 +208,7 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() {
            underTest.setMagneticRowTranslation(swipedRow, translation = 100f)

            // WHEN setting a translation that will fall above the threshold
            val translation = threshold / underTest.swipedRowMultiplier + 50f
            val translation = 150f
            underTest.setMagneticRowTranslation(swipedRow, translation)

            // THEN the swiped view does not detach and the reduced translation is set
@@ -355,7 +355,7 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() {
        underTest.setMagneticRowTranslation(swipedRow, translation = 100f)

        // Set a translation that will fall above the threshold
        val translation = threshold / underTest.swipedRowMultiplier + 50f
        val translation = 150f
        underTest.setMagneticRowTranslation(swipedRow, translation)

        assertThat(underTest.currentState).isEqualTo(State.DETACHED)
+2 −4
Original line number Diff line number Diff line
@@ -169,8 +169,7 @@ constructor(
    }

    private fun pullDismissibleRow(translation: Float) {
        val targetTranslation = swipedRowMultiplier * translation
        val crossedThreshold = abs(targetTranslation) >= magneticDetachThreshold
        val crossedThreshold = abs(translation) >= magneticDetachThreshold
        if (crossedThreshold) {
            snapNeighborsBack()
            currentMagneticListeners.swipedListener()?.let { detach(it, translation) }
@@ -247,8 +246,7 @@ constructor(
    }

    private fun translateDetachedRow(translation: Float) {
        val targetTranslation = swipedRowMultiplier * translation
        val crossedThreshold = abs(targetTranslation) <= magneticAttachThreshold
        val crossedThreshold = abs(translation) <= magneticAttachThreshold
        if (crossedThreshold) {
            translationOffset += translation
            updateRoundness(translation = 0f, animate = true)