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

[FR]: TODO update this implementation once paging Compose supports LazyGridScope #935

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.paging.PagingData
import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.collectAsLazyPagingItems
import androidx.paging.compose.itemKey
import com.google.samples.apps.sunflower.R
import com.google.samples.apps.sunflower.compose.plantlist.PhotoListItem
import com.google.samples.apps.sunflower.data.UnsplashPhoto
Expand Down Expand Up @@ -79,14 +80,9 @@ private fun GalleryScreen(
modifier = Modifier.padding(padding),
contentPadding = PaddingValues(all = dimensionResource(id = R.dimen.card_side_margin))
) {
// TODO update this implementation once paging Compose supports LazyGridScope
// See: https://issuetracker.google.com/issues/178087310
items(
count = pagingItems.itemCount,
key = { index ->
val photo = pagingItems[index]
"${ photo?.id ?: ""}${index}"
}
key = pagingItems.itemKey { it }
) { index ->
val photo = pagingItems[index] ?: return@items
PhotoListItem(photo = photo) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ minSdk = "23"
monitor = "1.6.0"
navigation = "2.5.3"
okhttpLogging = "4.10.0"
pagingCompose = "1.0.0-alpha18"
pagingCompose = "1.0.0-alpha19"
profileInstaller = "1.2.0"
recyclerView = "1.3.0-alpha02"
retrofit = "2.9.0"
Expand Down