This repository was archived by the owner on Aug 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed
app/src/main/java/com/google/samples/apps/sunflower/compose/gallery Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
40
40
import androidx.paging.PagingData
41
41
import androidx.paging.compose.LazyPagingItems
42
42
import androidx.paging.compose.collectAsLazyPagingItems
43
+ import androidx.paging.compose.itemKey
43
44
import com.google.samples.apps.sunflower.R
44
45
import com.google.samples.apps.sunflower.compose.plantlist.PhotoListItem
45
46
import com.google.samples.apps.sunflower.data.UnsplashPhoto
@@ -79,14 +80,9 @@ private fun GalleryScreen(
79
80
modifier = Modifier .padding(padding),
80
81
contentPadding = PaddingValues (all = dimensionResource(id = R .dimen.card_side_margin))
81
82
) {
82
- // TODO update this implementation once paging Compose supports LazyGridScope
83
- // See: https://issuetracker.google.com/issues/178087310
84
83
items(
85
84
count = pagingItems.itemCount,
86
- key = { index ->
87
- val photo = pagingItems[index]
88
- " ${ photo?.id ? : " " }${index} "
89
- }
85
+ key = pagingItems.itemKey { it }
90
86
) { index ->
91
87
val photo = pagingItems[index] ? : return @items
92
88
PhotoListItem (photo = photo) {
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ minSdk = "23"
45
45
monitor = " 1.6.0"
46
46
navigation = " 2.5.3"
47
47
okhttpLogging = " 4.10.0"
48
- pagingCompose = " 1.0.0-alpha18 "
48
+ pagingCompose = " 1.0.0-alpha19 "
49
49
profileInstaller = " 1.2.0"
50
50
recyclerView = " 1.3.0-alpha02"
51
51
retrofit = " 2.9.0"
You can’t perform that action at this time.
0 commit comments