Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Commit cdccad4

Browse files
tjmticarriolac
andauthored
Update pagingCompose dependencyversion, Update LazyGridScope Implementation (#935)
Co-authored-by: Chris Arriola <chrisarriola@google.com>
1 parent 0a07de2 commit cdccad4

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

app/src/main/java/com/google/samples/apps/sunflower/compose/gallery/GalleryScreen.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
4040
import androidx.paging.PagingData
4141
import androidx.paging.compose.LazyPagingItems
4242
import androidx.paging.compose.collectAsLazyPagingItems
43+
import androidx.paging.compose.itemKey
4344
import com.google.samples.apps.sunflower.R
4445
import com.google.samples.apps.sunflower.compose.plantlist.PhotoListItem
4546
import com.google.samples.apps.sunflower.data.UnsplashPhoto
@@ -79,14 +80,9 @@ private fun GalleryScreen(
7980
modifier = Modifier.padding(padding),
8081
contentPadding = PaddingValues(all = dimensionResource(id = R.dimen.card_side_margin))
8182
) {
82-
// TODO update this implementation once paging Compose supports LazyGridScope
83-
// See: https://issuetracker.google.com/issues/178087310
8483
items(
8584
count = pagingItems.itemCount,
86-
key = { index ->
87-
val photo = pagingItems[index]
88-
"${ photo?.id ?: ""}${index}"
89-
}
85+
key = pagingItems.itemKey { it }
9086
) { index ->
9187
val photo = pagingItems[index] ?: return@items
9288
PhotoListItem(photo = photo) {

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ minSdk = "23"
4545
monitor = "1.6.0"
4646
navigation = "2.5.3"
4747
okhttpLogging = "4.10.0"
48-
pagingCompose = "1.0.0-alpha18"
48+
pagingCompose = "1.0.0-alpha19"
4949
profileInstaller = "1.2.0"
5050
recyclerView = "1.3.0-alpha02"
5151
retrofit = "2.9.0"

0 commit comments

Comments
 (0)