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

Commit 7ba34c7a authored by Bryce Lee's avatar Bryce Lee
Browse files

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
parent c7aa0be4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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
+9 −3
Original line number Diff line number Diff line
@@ -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,