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

Commit

Permalink
Update Glide implementation and item key ID. (#941)
Browse files Browse the repository at this point in the history
Change-Id: I3d9182d209ac85dc338f2b7b123b2a788e4453ed
  • Loading branch information
arriolac authored Dec 28, 2023
1 parent 5f864ae commit 9a00783
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,13 @@ private fun GalleryScreen(
.padding(padding)
.nestedScroll(pullToRefreshState.nestedScrollConnection)
) {

LazyVerticalGrid(
columns = GridCells.Fixed(2),
contentPadding = PaddingValues(all = dimensionResource(id = R.dimen.card_side_margin))
) {
items(
count = pagingItems.itemCount,
key = pagingItems.itemKey { it }
key = pagingItems.itemKey { it.id }
) { index ->
val photo = pagingItems[index] ?: return@items
PhotoListItem(photo = photo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,18 @@ private fun PlantImage(
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable>,
isFirstResource: Boolean
): Boolean {
isLoading = false
return false
}

override fun onResourceReady(
resource: Drawable?,
model: Any?,
resource: Drawable,
model: Any,
target: Target<Drawable>?,
dataSource: DataSource?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
isLoading = false
Expand Down Expand Up @@ -596,4 +596,4 @@ private fun PlantDetailContentPreview() {
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.DefaultAlpha
import androidx.compose.ui.graphics.painter.ColorPainter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -65,10 +67,6 @@ fun SunflowerImage(
alpha = alpha,
colorFilter = colorFilter,
requestBuilderTransform = requestBuilderTransform,
loading = placeholder {
Box(modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
CircularProgressIndicator(Modifier.size(40.dp))
}
}
loading = placeholder(ColorPainter(MaterialTheme.colorScheme.secondary))
)
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ constraintLayoutCompose = "1.0.1"
coreTesting = "2.2.0"
coroutines = "1.6.4"
espresso = "3.4.0"
glide = "1.0.0-alpha.3"
glide = "1.0.0-beta01"
gradle = "7.2.0"
gson = "2.9.0"
guava = "31.1-android"
Expand Down

0 comments on commit 9a00783

Please sign in to comment.