Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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