summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bryce Lee <brycelee@google.com> 2024-05-29 17:35:41 -0700
committer Bryce Lee <brycelee@google.com> 2024-05-29 18:53:54 -0700
commitbbedf5f5a156629b65d0473190969451569d2f86 (patch)
tree8fc34880587b881c7f462edceaf4788569ab5b59
parentfd5cf91931a124409ef1114b2902d96609ab78f4 (diff)
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
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt10
1 files changed, 10 insertions, 0 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 cd27d5713c2d..4eeda1a8aa44 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
@@ -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(),