Fixes icons size in onboarding and restores LocalInspection for images (#909)

* Fixes icons size in onboarding and restores LocalInspection for images
pull/912/head
Jose Alcérreca 1 year ago committed by GitHub
parent 6645ec9fce
commit 6c0d6ad82e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,6 +31,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
@ -60,11 +61,12 @@ fun DynamicAsyncImage(
isError = state is Error
},
)
val isLocalInspection = LocalInspectionMode.current
Box(
modifier = modifier,
contentAlignment = Alignment.Center,
) {
if (isLoading) {
if (isLoading && !isLocalInspection) {
// Display a progress bar while loading
CircularProgressIndicator(
modifier = Modifier
@ -75,10 +77,9 @@ fun DynamicAsyncImage(
}
Image(
contentScale = ContentScale.Crop,
painter = if (isError.not()) imageLoader else placeholder,
painter = if (isError.not() && !isLocalInspection) imageLoader else placeholder,
contentDescription = contentDescription,
colorFilter = if (iconTint != null) ColorFilter.tint(iconTint) else null,
modifier = modifier,
)
}
}

@ -158,6 +158,7 @@ fun NewsResourceHeaderImage(
isError = state is AsyncImagePainter.State.Error
},
)
val isLocalInspection = LocalInspectionMode.current
Box(
modifier = Modifier
.fillMaxWidth()
@ -179,7 +180,11 @@ fun NewsResourceHeaderImage(
.fillMaxWidth()
.height(180.dp),
contentScale = ContentScale.Crop,
painter = if (isError.not()) imageLoader else painterResource(drawable.ic_placeholder_default),
painter = if (isError.not() && !isLocalInspection) {
imageLoader
} else {
painterResource(drawable.ic_placeholder_default)
},
// TODO b/226661685: Investigate using alt text of image to populate content description
contentDescription = null, // decorative image,
)

Loading…
Cancel
Save