From 77451779cd968eaeb93969e556437f145dd583db Mon Sep 17 00:00:00 2001 From: dahunsi Date: Fri, 15 Sep 2023 08:51:29 -0700 Subject: [PATCH] Use animateItemPlacement() on feed Change-Id: Id120a6e84e0641679fa54ebf0e34bb04165aa419 --- .../google/samples/apps/nowinandroid/core/ui/NewsFeed.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt b/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt index 85f9951b8..e2904afc3 100644 --- a/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt +++ b/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt @@ -21,6 +21,7 @@ import android.net.Uri import androidx.annotation.ColorInt import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabsIntent +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope @@ -47,6 +48,7 @@ import com.google.samples.apps.nowinandroid.core.model.data.UserNewsResource * An extension on [LazyListScope] defining a feed with news resources. * Depending on the [feedState], this might emit no items. */ +@OptIn(ExperimentalFoundationApi::class) fun LazyStaggeredGridScope.newsFeed( feedState: NewsFeedUiState, onNewsResourcesCheckedChanged: (String, Boolean) -> Unit, @@ -88,7 +90,9 @@ fun LazyStaggeredGridScope.newsFeed( ) }, onTopicClick = onTopicClick, - modifier = Modifier.padding(horizontal = 8.dp), + modifier = Modifier + .padding(horizontal = 8.dp) + .animateItemPlacement(), ) } }