summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bryce Lee <brycelee@google.com> 2024-07-08 17:11:32 -0700
committer Bryce Lee <brycelee@google.com> 2024-07-08 17:14:40 -0700
commit7ba34c7a6cbcd8fe386bbe4b8cbb0d0f2df9ea25 (patch)
treef2041b84bd5d29737b2dfc5705ee50e67c616af3
parentc7aa0be40fba631117882fa7cc380ea9394f372f (diff)
Move CommunalSwipeDetector.
This changelist moves the class closer to the associated usage. Fixes: 351913024 Test: verified builds and run (simple refactor) Flag: EXEMPT refactor Change-Id: Ib1c18a195221ec45e8a37bf1827bc27daf150a1d
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt1
-rw-r--r--packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt (renamed from packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/CommunalSwipeDetector.kt)12
2 files changed, 9 insertions, 4 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
index d0466313cf81..43d51c37aa36 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
@@ -28,7 +28,6 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.scene.Back
-import com.android.compose.animation.scene.CommunalSwipeDetector
import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.ElementKey
import com.android.compose.animation.scene.ElementMatcher
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/CommunalSwipeDetector.kt b/packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt
index 7be34cabfaf8..3fda9b85a5c2 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/CommunalSwipeDetector.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.compose.animation.scene
+package com.android.systemui.communal.ui.compose
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.ui.input.pointer.PointerInputChange
@@ -22,10 +22,12 @@ import androidx.compose.ui.input.pointer.positionChange
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
+import com.android.compose.animation.scene.Edge
+import com.android.compose.animation.scene.SwipeDetector
+import com.android.compose.animation.scene.SwipeSource
+import com.android.compose.animation.scene.SwipeSourceDetector
import kotlin.math.abs
-private const val TRAVEL_RATIO_THRESHOLD = .5f
-
/**
* {@link CommunalSwipeDetector} provides an implementation of {@link SwipeDetector} and {@link
* SwipeSourceDetector} to enable fullscreen swipe handling to transition to and from the glanceable
@@ -33,6 +35,10 @@ private const val TRAVEL_RATIO_THRESHOLD = .5f
*/
class CommunalSwipeDetector(private var lastDirection: SwipeSource? = null) :
SwipeSourceDetector, SwipeDetector {
+ companion object {
+ private const val TRAVEL_RATIO_THRESHOLD = .5f
+ }
+
override fun source(
layoutSize: IntSize,
position: IntOffset,