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

Commit 6f355ec2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure item being dragged shows on top of other items" into main

parents 32e63a71 7fd21a2d
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ import androidx.compose.ui.unit.times
import androidx.compose.ui.util.fastAll
import androidx.compose.ui.viewinterop.AndroidView
import androidx.compose.ui.viewinterop.NoOpUpdate
import androidx.compose.ui.zIndex
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.window.layout.WindowMetricsCalculator
import com.android.compose.animation.Easings.Emphasized
@@ -796,6 +797,7 @@ private fun BoxScope.CommunalHubLazyGrid(
                }

            if (viewModel.isEditMode && dragDropState != null) {
                val isItemDragging = dragDropState.draggingItemKey == item.key
                val outlineAlpha by
                    animateFloatAsState(
                        targetValue = if (selected) 1f else 0f,
@@ -812,13 +814,13 @@ private fun BoxScope.CommunalHubLazyGrid(
                    enabled = selected,
                    alpha = { outlineAlpha },
                    modifier =
                        Modifier.requiredSize(dpSize).thenIf(
                            dragDropState.draggingItemKey != item.key
                        ) {
                        Modifier.requiredSize(dpSize)
                            .thenIf(!isItemDragging) {
                                Modifier.animateItem(
                                    placementSpec = spring(stiffness = Spring.StiffnessMediumLow)
                                )
                        },
                            }
                            .thenIf(isItemDragging) { Modifier.zIndex(1f) },
                    onResize = { resizeInfo -> contentListState.resize(index, resizeInfo) },
                    minHeightPx = widgetSizeInfo.minHeightPx,
                    maxHeightPx = widgetSizeInfo.maxHeightPx,