Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -488,6 +488,25 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { assertThat(detachDirection).isEqualTo(-1) } @Test fun getDetachDirection_afterADismissal_returnsCorrectDirection() = kosmos.testScope.runTest { // GIVEN that the swiped row is detached to the right setDetachedState() assertThat(underTest.getDetachDirection(swipedRow)).isEqualTo(1) // GIVEN that the notification is dismissed underTest.onMagneticInteractionEnd(swipedRow, dismissing = true, velocity = 5000f) // WHEN we begin interacting with another row swipedRow = children.attachedChildren.first() setTargets() underTest.setMagneticRowTranslation(swipedRow, translation = 100f) // THEN the detach direction is 0 assertThat(underTest.getDetachDirection(swipedRow)).isEqualTo(0) } @After fun tearDown() { // We reset the manager so that all MagneticRowListener can cancel all animations Loading packages/SystemUI/src/com/android/systemui/SwipeHelper.java +4 −1 Original line number Diff line number Diff line Loading @@ -429,8 +429,11 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { boolean isDismissAll) { if (magneticNotificationSwipes()) { int direction = mCallback.getMagneticDetachDirection(animView); if (direction != 0) { // If detached, modify the velocity to agree with the detaching direction velocity = direction * Math.max(getMinDismissVelocity(), Math.abs(velocity)); } } final boolean canBeDismissed = mCallback.canChildBeDismissed(animView); float newPos; boolean isLayoutRtl = animView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt +1 −0 Original line number Diff line number Diff line Loading @@ -484,6 +484,7 @@ constructor( } fun reset() { direction = 0f translationBuffer.clear() acceptTranslations = true } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -488,6 +488,25 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { assertThat(detachDirection).isEqualTo(-1) } @Test fun getDetachDirection_afterADismissal_returnsCorrectDirection() = kosmos.testScope.runTest { // GIVEN that the swiped row is detached to the right setDetachedState() assertThat(underTest.getDetachDirection(swipedRow)).isEqualTo(1) // GIVEN that the notification is dismissed underTest.onMagneticInteractionEnd(swipedRow, dismissing = true, velocity = 5000f) // WHEN we begin interacting with another row swipedRow = children.attachedChildren.first() setTargets() underTest.setMagneticRowTranslation(swipedRow, translation = 100f) // THEN the detach direction is 0 assertThat(underTest.getDetachDirection(swipedRow)).isEqualTo(0) } @After fun tearDown() { // We reset the manager so that all MagneticRowListener can cancel all animations Loading
packages/SystemUI/src/com/android/systemui/SwipeHelper.java +4 −1 Original line number Diff line number Diff line Loading @@ -429,8 +429,11 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { boolean isDismissAll) { if (magneticNotificationSwipes()) { int direction = mCallback.getMagneticDetachDirection(animView); if (direction != 0) { // If detached, modify the velocity to agree with the detaching direction velocity = direction * Math.max(getMinDismissVelocity(), Math.abs(velocity)); } } final boolean canBeDismissed = mCallback.canChildBeDismissed(animView); float newPos; boolean isLayoutRtl = animView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt +1 −0 Original line number Diff line number Diff line Loading @@ -484,6 +484,7 @@ constructor( } fun reset() { direction = 0f translationBuffer.clear() acceptTranslations = true } Loading