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

Commit 4e2579c7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move the system gesture exclusion after the badge layout" into main

parents 73d63ffc cfe3d7fa
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ fun InteractiveTileContainer(
    val badgeIconAlpha by transition.animateFloat { state -> if (state == Removable) 1f else 0f }
    val selectionBorderAlpha by
        transition.animateFloat { state -> if (state == Selected) 1f else 0f }
    val isIdle = transition.currentState == transition.targetState
    val isDraggable = tileState == Selected

    Box(
        modifier.resizable(tileState == Selected, resizingState).selectionBorder(
@@ -135,6 +137,7 @@ fun InteractiveTileContainer(
        MinimumInteractiveSizeComponent(
            angle = { decorationAngle },
            offset = { decorationOffset },
            excludeSystemGesture = isIdle && isDraggable,
        ) {
            Box(
                Modifier.fillMaxSize()
@@ -148,7 +151,7 @@ fun InteractiveTileContainer(
                    }
                    .graphicsLayer { this.alpha = decorationAlpha }
                    .anchoredDraggable(
                        enabled = tileState == Selected,
                        enabled = isDraggable,
                        state = resizingState.anchoredDraggableState,
                        orientation = Orientation.Horizontal,
                    )
@@ -236,6 +239,7 @@ private fun MinimumInteractiveSizeComponent(
    angle: () -> Float,
    offset: () -> Offset,
    modifier: Modifier = Modifier,
    excludeSystemGesture: Boolean = false,
    content: @Composable BoxScope.() -> Unit = {},
) {
    // Use a higher zIndex than the tile to draw over it, and manually create the touch target
@@ -246,7 +250,6 @@ private fun MinimumInteractiveSizeComponent(
        modifier =
            modifier
                .zIndex(2f)
                .systemGestureExclusion { Rect(Offset.Zero, it.size.toSize()) }
                .layout { measurable, constraints ->
                    val size = minTouchTargetSize.roundToPx()
                    val placeable = measurable.measure(Constraints.fixed(size, size))
@@ -259,6 +262,9 @@ private fun MinimumInteractiveSizeComponent(
                            position.y.roundToInt() - placeable.height / 2,
                        )
                    }
                }
                .thenIf(excludeSystemGesture) {
                    Modifier.systemGestureExclusion { Rect(Offset.Zero, it.size.toSize()) }
                },
        content = content,
    )