diff options
2 files changed, 14 insertions, 4 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt index fff1410cb8cb..8bd5ddb060c3 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt @@ -205,8 +205,12 @@ private fun BoxScope.CommunalHubLazyGrid( list[index].size.dp().value, ) if (viewModel.isEditMode && dragDropState != null) { - DraggableItem(dragDropState = dragDropState, enabled = true, index = index) { - isDragging -> + DraggableItem( + dragDropState = dragDropState, + enabled = true, + index = index, + size = size + ) { isDragging -> val elevation by animateDpAsState(if (isDragging) 4.dp else 1.dp) CommunalContent( modifier = cardModifier, diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt index 0d460aa8d464..1b40de4ef5df 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt @@ -16,6 +16,7 @@ package com.android.systemui.communal.ui.compose +import android.util.SizeF import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.gestures.detectDragGesturesAfterLongPress import androidx.compose.foundation.gestures.scrollBy @@ -233,6 +234,7 @@ fun LazyGridItemScope.DraggableItem( dragDropState: GridDragDropState, index: Int, enabled: Boolean, + size: SizeF, modifier: Modifier = Modifier, content: @Composable (isDragging: Boolean) -> Unit ) { @@ -250,7 +252,11 @@ fun LazyGridItemScope.DraggableItem( } else { Modifier.animateItemPlacement() } - Box(modifier = modifier.then(draggingModifier), propagateMinConstraints = true) { - content(dragging) + + Box(modifier) { + if (dragging) { + WidgetPlaceholderContent(size) + } + Box(modifier = draggingModifier, propagateMinConstraints = true) { content(dragging) } } } |