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

Update Glide implementation and item key ID. #941

Merged
merged 3 commits into from
Dec 28, 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 @@ -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