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

Commit 41bbda58 authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Move CommunalSwipeDetector." into main

parents 5c248863 7ba34c7a
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,