Skip to content

Commit

Permalink
Coil3: also show the loader when the request is not yet started (Stat…
Browse files Browse the repository at this point in the history
…e.Empty)
  • Loading branch information
bmarty committed Mar 3, 2025
1 parent ae56fbc commit db55b69
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fun StaticMapView(
)
} else {
StaticMapPlaceholder(
showProgress = collectedState.value is AsyncImagePainter.State.Loading,
showProgress = collectedState.value.isLoading(),
contentDescription = contentDescription,
width = maxWidth,
height = maxHeight,
Expand All @@ -112,6 +112,11 @@ fun StaticMapView(
}
}

private fun AsyncImagePainter.State.isLoading(): Boolean {
return this is AsyncImagePainter.State.Empty ||
this is AsyncImagePainter.State.Loading
}

@PreviewsDayNight
@Composable
internal fun StaticMapViewPreview() = ElementPreview {
Expand Down

0 comments on commit db55b69

Please sign in to comment.