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

Commit 2ea05877 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Revert "[flexiglass] Adds gestureFilter lambda to STL"

This reverts commit f9a01533.

Reason for revert: As discussed offline, the system gesture exclusion
was introduced for back gesture, so it should not be used for our
custom use cases. Moreover the gestureFilter API introduced in this CL
probably does not work as we would expect given that we still consume
(but ignore) all pointer events if the gesture is filtered. A better
name for this would have been "consumeButIgnoreGesture: (Offset) ->
Boolean", which highlights why this API should probably not be
introduced in the first place.

Change-Id: I2501b39e0a18b8659578eaac443a12a7a3da5102
parent efc0c5a3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@ fun SceneContainer(
            state = state,
            modifier = modifier.fillMaxSize(),
            swipeSourceDetector = viewModel.edgeDetector,
            gestureFilter = viewModel::shouldFilterGesture,
        ) {
            sceneByKey.forEach { (sceneKey, scene) ->
                scene(
+0 −4
Original line number Diff line number Diff line
@@ -124,10 +124,6 @@ internal class DraggableHandlerImpl(
        overSlop: Float,
        pointersDown: Int,
    ): DragController {
        if (startedPosition != null && layoutImpl.gestureFilter(startedPosition)) {
            return NoOpDragController
        }

        if (overSlop == 0f) {
            val oldDragController = dragController
            check(oldDragController != null && oldDragController.isDrivingTransition) {
+0 −7
Original line number Diff line number Diff line
@@ -47,9 +47,6 @@ import androidx.compose.ui.unit.LayoutDirection
 * @param state the state of this layout.
 * @param swipeSourceDetector the edge detector used to detect which edge a swipe is started from,
 *   if any.
 * @param gestureFilter decides whether a drag gesture that started at the given start position
 *   should be filtered. If the lambda returns `true`, the drag gesture will be ignored. If it
 *   returns `false`, the drag gesture will be handled.
 * @param transitionInterceptionThreshold used during a scene transition. For the scene to be
 *   intercepted, the progress value must be above the threshold, and below (1 - threshold).
 * @param builder the configuration of the different scenes and overlays of this layout.
@@ -60,7 +57,6 @@ fun SceneTransitionLayout(
    modifier: Modifier = Modifier,
    swipeSourceDetector: SwipeSourceDetector = DefaultEdgeDetector,
    swipeDetector: SwipeDetector = DefaultSwipeDetector,
    gestureFilter: (startedPosition: Offset) -> Boolean = DefaultGestureFilter,
    @FloatRange(from = 0.0, to = 0.5) transitionInterceptionThreshold: Float = 0.05f,
    builder: SceneTransitionLayoutScope.() -> Unit,
) {
@@ -69,7 +65,6 @@ fun SceneTransitionLayout(
        modifier,
        swipeSourceDetector,
        swipeDetector,
        gestureFilter,
        transitionInterceptionThreshold,
        onLayoutImpl = null,
        builder,
@@ -621,7 +616,6 @@ internal fun SceneTransitionLayoutForTesting(
    modifier: Modifier = Modifier,
    swipeSourceDetector: SwipeSourceDetector = DefaultEdgeDetector,
    swipeDetector: SwipeDetector = DefaultSwipeDetector,
    gestureFilter: (startedPosition: Offset) -> Boolean = DefaultGestureFilter,
    transitionInterceptionThreshold: Float = 0f,
    onLayoutImpl: ((SceneTransitionLayoutImpl) -> Unit)? = null,
    builder: SceneTransitionLayoutScope.() -> Unit,
@@ -638,7 +632,6 @@ internal fun SceneTransitionLayoutForTesting(
                transitionInterceptionThreshold = transitionInterceptionThreshold,
                builder = builder,
                animationScope = animationScope,
                gestureFilter = gestureFilter,
            )
            .also { onLayoutImpl?.invoke(it) }
    }
+0 −2
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import androidx.compose.runtime.snapshots.SnapshotStateMap
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.layout.ApproachLayoutModifierNode
import androidx.compose.ui.layout.ApproachMeasureScope
import androidx.compose.ui.layout.LookaheadScope
@@ -71,7 +70,6 @@ internal class SceneTransitionLayoutImpl(
     * animations.
     */
    internal val animationScope: CoroutineScope,
    internal val gestureFilter: (startedPosition: Offset) -> Boolean,
) {
    /**
     * The map of [Scene]s.
+0 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.compose.animation.scene

import androidx.compose.runtime.Stable
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.pointer.PointerInputChange

/** {@link SwipeDetector} helps determine whether a swipe gestured has occurred. */
@@ -32,8 +31,6 @@ interface SwipeDetector {

val DefaultSwipeDetector = PassthroughSwipeDetector()

val DefaultGestureFilter = { _: Offset -> false }

/** An {@link SwipeDetector} implementation that recognizes a swipe on any input. */
class PassthroughSwipeDetector : SwipeDetector {
    override fun detectSwipe(change: PointerInputChange): Boolean {
Loading