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

Commit bbedf5f5 authored by Bryce Lee's avatar Bryce Lee
Browse files

Animate widget position when editing.

This changelist animates item placement in the Communal Hub when in
edit mode.

Test: manually verified animations were present during edit mode.
Fixes: 340353071
Flag: com.android.systemui.communal_hub
Change-Id: Ie58e8fe7fe88a892387aafcae52880f2779ce037
parent fd5cf919
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -27,7 +27,9 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
@@ -446,6 +448,14 @@ private fun BoxScope.CommunalHubLazyGrid(
                val selected by
                    remember(index) { derivedStateOf { list[index].key == selectedKey.value } }
                DraggableItem(
                    modifier =
                        if (dragDropState.draggingItemIndex == index) {
                            Modifier
                        } else {
                            Modifier.animateItem(
                                placementSpec = spring(stiffness = Spring.StiffnessMediumLow)
                            )
                        },
                    dragDropState = dragDropState,
                    selected = selected,
                    enabled = list[index].isWidgetContent(),