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

Commit fc64e3c8 authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Exclude back gesture on selected tiles to allow for resizing

Flag: com.android.systemui.qs_ui_refactor_compose_fragment
Bug: 350984160
Test: manually
Change-Id: I3d4ea91cd508838afd2c394fb221e395e6035a1f
parent 489039c3
Loading
Loading
Loading
Loading
+16 −8
Original line number Original line Diff line number Diff line
@@ -20,14 +20,18 @@ import androidx.compose.foundation.Canvas
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.systemGestureExclusion
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.toSize
import com.android.systemui.qs.panels.ui.compose.selection.SelectionDefaults.ResizingDotSize
import com.android.systemui.qs.panels.ui.compose.selection.SelectionDefaults.ResizingDotSize


/**
/**
@@ -52,10 +56,14 @@ fun ResizingHandle(
        // not receive the touch input accidentally.
        // not receive the touch input accidentally.
        val minTouchTargetSize = LocalMinimumInteractiveComponentSize.current
        val minTouchTargetSize = LocalMinimumInteractiveComponentSize.current
        Box(
        Box(
            Modifier.size(minTouchTargetSize).pointerInput(Unit) {
            Modifier.size(minTouchTargetSize)
                .systemGestureExclusion { Rect(Offset.Zero, it.size.toSize()) }
                .pointerInput(Unit) {
                    detectHorizontalDragGestures(
                    detectHorizontalDragGestures(
                        onHorizontalDrag = { _, offset -> selectionState.onResizingDrag(offset) },
                        onHorizontalDrag = { _, offset -> selectionState.onResizingDrag(offset) },
                    onDragStart = { tileWidths()?.let { selectionState.onResizingDragStart(it) } },
                        onDragStart = {
                            tileWidths()?.let { selectionState.onResizingDragStart(it) }
                        },
                        onDragEnd = selectionState::onResizingDragEnd,
                        onDragEnd = selectionState::onResizingDragEnd,
                        onDragCancel = selectionState::onResizingDragEnd,
                        onDragCancel = selectionState::onResizingDragEnd,
                    )
                    )