Skip to content

Commit

Permalink
Fixes icons size in onboarding and restores LocalInspection for images (
Browse files Browse the repository at this point in the history
#909)

* Fixes icons size in onboarding and restores LocalInspection for images
  • Loading branch information
JoseAlcerreca authored Aug 18, 2023
1 parent 6645ec9 commit 6c0d6ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ fun NewsResourceHeaderImage(
isError = state is AsyncImagePainter.State.Error
},
)
val isLocalInspection = LocalInspectionMode.current
Box(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -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,
)
Expand Down

0 comments on commit 6c0d6ad

Please sign in to comment.