summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Olivier St-Onge <ostonge@google.com> 2024-09-24 09:06:02 -0400
committer Olivier St-Onge <ostonge@google.com> 2024-09-24 15:41:51 -0400
commitfc64e3c8b71fe73e10e8fc9cb65224bdc011c4dc (patch)
tree5225a0ab453dbf208a26b7ffe0704096fe3b0598
parent489039c3aabda3f5a6538541cfa216c11ea4e4bb (diff)
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
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt24
1 files changed, 16 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt
index 7c62e5995ce8..e0f0b6aa8919 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt
@@ -20,14 +20,18 @@ import androidx.compose.foundation.Canvas
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.systemGestureExclusion
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
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.input.pointer.pointerInput
import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.toSize
import com.android.systemui.qs.panels.ui.compose.selection.SelectionDefaults.ResizingDotSize
/**
@@ -52,14 +56,18 @@ fun ResizingHandle(
// not receive the touch input accidentally.
val minTouchTargetSize = LocalMinimumInteractiveComponentSize.current
Box(
- Modifier.size(minTouchTargetSize).pointerInput(Unit) {
- detectHorizontalDragGestures(
- onHorizontalDrag = { _, offset -> selectionState.onResizingDrag(offset) },
- onDragStart = { tileWidths()?.let { selectionState.onResizingDragStart(it) } },
- onDragEnd = selectionState::onResizingDragEnd,
- onDragCancel = selectionState::onResizingDragEnd,
- )
- }
+ Modifier.size(minTouchTargetSize)
+ .systemGestureExclusion { Rect(Offset.Zero, it.size.toSize()) }
+ .pointerInput(Unit) {
+ detectHorizontalDragGestures(
+ onHorizontalDrag = { _, offset -> selectionState.onResizingDrag(offset) },
+ onDragStart = {
+ tileWidths()?.let { selectionState.onResizingDragStart(it) }
+ },
+ onDragEnd = selectionState::onResizingDragEnd,
+ onDragCancel = selectionState::onResizingDragEnd,
+ )
+ }
) {
ResizingDot(transition = transition, modifier = Modifier.align(Alignment.Center))
}