Coil3: also show the loader when the request is not yet started (State.Empty)
This commit is contained in:
parent
42fcf31080
commit
e82ca3ffe5
1 changed files with 6 additions and 1 deletions
|
|
@ -102,7 +102,7 @@ fun StaticMapView(
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
StaticMapPlaceholder(
|
StaticMapPlaceholder(
|
||||||
showProgress = collectedState.value is AsyncImagePainter.State.Loading,
|
showProgress = collectedState.value.isLoading(),
|
||||||
contentDescription = contentDescription,
|
contentDescription = contentDescription,
|
||||||
width = maxWidth,
|
width = maxWidth,
|
||||||
height = maxHeight,
|
height = maxHeight,
|
||||||
|
|
@ -112,6 +112,11 @@ fun StaticMapView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun AsyncImagePainter.State.isLoading(): Boolean {
|
||||||
|
return this is AsyncImagePainter.State.Empty ||
|
||||||
|
this is AsyncImagePainter.State.Loading
|
||||||
|
}
|
||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun StaticMapViewPreview() = ElementPreview {
|
internal fun StaticMapViewPreview() = ElementPreview {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue