diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/DragAndDropState.kt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/DragAndDropState.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/DragAndDropState.kt index 0b9cd96670b1..9a2315be29a2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/DragAndDropState.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/DragAndDropState.kt @@ -158,18 +158,20 @@ private fun insertAfter(item: LazyGridItemInfo, offset: Offset): Boolean { return item.span != 1 && offset.x > itemCenter.x } +@Composable fun Modifier.dragAndDropTileSource( sizedTile: SizedTile<EditTileViewModel>, onTap: (TileSpec) -> Unit, onDoubleTap: (TileSpec) -> Unit, dragAndDropState: DragAndDropState ): Modifier { + val state by rememberUpdatedState(dragAndDropState) return dragAndDropSource { detectTapGestures( onTap = { onTap(sizedTile.tile.tileSpec) }, onDoubleTap = { onDoubleTap(sizedTile.tile.tileSpec) }, onLongPress = { - dragAndDropState.onStarted(sizedTile) + state.onStarted(sizedTile) // The tilespec from the ClipData transferred isn't actually needed as we're moving // a tile within the same application. We're using a custom MIME type to limit the |