diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt index aab4adce6f..8065164ad7 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt @@ -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, @@ -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 {