Loading packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +12 −12 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.foundation.lazy.grid.LazyGridState import androidx.compose.foundation.lazy.grid.LazyHorizontalGrid import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.selection.selectable Loading Loading @@ -690,21 +691,20 @@ private fun BoxScope.CommunalHubLazyGrid( horizontalArrangement = Arrangement.spacedBy(Dimensions.ItemSpacing), verticalArrangement = Arrangement.spacedBy(Dimensions.ItemSpacing), ) { items( count = list.size, key = { index -> list[index].key }, contentType = { index -> list[index].key }, span = { index -> GridItemSpan(list[index].size.span) }, ) { index -> itemsIndexed( items = list, key = { _, item -> item.key }, contentType = { _, item -> item.key }, span = { _, item -> GridItemSpan(item.size.span) }, ) { index, item -> val size = SizeF( Dimensions.CardWidth.value, list[index].size.dp().value, item.size.dp().value, ) val cardModifier = Modifier.requiredSize(width = size.width.dp, height = size.height.dp) if (viewModel.isEditMode && dragDropState != null) { val selected by remember(index) { derivedStateOf { list[index].key == selectedKey.value } } val selected = item.key == selectedKey.value DraggableItem( modifier = if (dragDropState.draggingItemIndex == index) { Loading @@ -716,12 +716,12 @@ private fun BoxScope.CommunalHubLazyGrid( }, dragDropState = dragDropState, selected = selected, enabled = list[index].isWidgetContent(), enabled = item.isWidgetContent(), index = index, ) { isDragging -> CommunalContent( modifier = cardModifier, model = list[index], model = item, viewModel = viewModel, size = size, selected = selected && !isDragging, Loading @@ -734,7 +734,7 @@ private fun BoxScope.CommunalHubLazyGrid( } } else { CommunalContent( model = list[index], model = item, viewModel = viewModel, size = size, selected = false, Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +12 −12 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.foundation.lazy.grid.LazyGridState import androidx.compose.foundation.lazy.grid.LazyHorizontalGrid import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.selection.selectable Loading Loading @@ -690,21 +691,20 @@ private fun BoxScope.CommunalHubLazyGrid( horizontalArrangement = Arrangement.spacedBy(Dimensions.ItemSpacing), verticalArrangement = Arrangement.spacedBy(Dimensions.ItemSpacing), ) { items( count = list.size, key = { index -> list[index].key }, contentType = { index -> list[index].key }, span = { index -> GridItemSpan(list[index].size.span) }, ) { index -> itemsIndexed( items = list, key = { _, item -> item.key }, contentType = { _, item -> item.key }, span = { _, item -> GridItemSpan(item.size.span) }, ) { index, item -> val size = SizeF( Dimensions.CardWidth.value, list[index].size.dp().value, item.size.dp().value, ) val cardModifier = Modifier.requiredSize(width = size.width.dp, height = size.height.dp) if (viewModel.isEditMode && dragDropState != null) { val selected by remember(index) { derivedStateOf { list[index].key == selectedKey.value } } val selected = item.key == selectedKey.value DraggableItem( modifier = if (dragDropState.draggingItemIndex == index) { Loading @@ -716,12 +716,12 @@ private fun BoxScope.CommunalHubLazyGrid( }, dragDropState = dragDropState, selected = selected, enabled = list[index].isWidgetContent(), enabled = item.isWidgetContent(), index = index, ) { isDragging -> CommunalContent( modifier = cardModifier, model = list[index], model = item, viewModel = viewModel, size = size, selected = selected && !isDragging, Loading @@ -734,7 +734,7 @@ private fun BoxScope.CommunalHubLazyGrid( } } else { CommunalContent( model = list[index], model = item, viewModel = viewModel, size = size, selected = false, Loading