2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

For #26587 - Replace the color in DefaultImagePlaceholder with FirefoxTheme layer2

This commit is contained in:
Noah Bond 2022-08-22 11:43:50 -07:00 committed by mergify[bot]
parent 45f998ee95
commit a9b2f1c6a7
2 changed files with 16 additions and 17 deletions

View File

@ -17,6 +17,7 @@ import androidx.compose.ui.unit.dp
import mozilla.components.support.images.compose.loader.ImageLoader
import mozilla.components.support.images.compose.loader.WithImage
import org.mozilla.fenix.components.components
import org.mozilla.fenix.theme.FirefoxTheme
/**
* A composable that lays out and draws the image from a given URL while showing a default placeholder
@ -75,8 +76,10 @@ fun Image(
@Composable
@Preview
private fun ImagePreview() {
FirefoxTheme {
Image(
"https://mozilla.com",
Modifier.height(100.dp).width(200.dp)
url = "https://mozilla.com",
modifier = Modifier.height(100.dp).width(200.dp)
)
}
}

View File

@ -5,7 +5,6 @@
package org.mozilla.fenix.compose
import androidx.compose.foundation.Image
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
@ -17,7 +16,7 @@ import androidx.compose.ui.unit.dp
import mozilla.components.support.images.compose.loader.Fallback
import mozilla.components.support.images.compose.loader.ImageLoaderScope
import mozilla.components.support.images.compose.loader.Placeholder
import mozilla.components.ui.colors.PhotonColors
import org.mozilla.fenix.theme.FirefoxTheme
/**
* Renders the app default image placeholder while the image is still getting loaded.
@ -68,20 +67,17 @@ internal fun DefaultImagePlaceholder(
modifier: Modifier,
contentDescription: String? = null
) {
val color = when (isSystemInDarkTheme()) {
true -> PhotonColors.DarkGrey30
false -> PhotonColors.LightGrey30
}
Image(ColorPainter(color), contentDescription, modifier)
Image(ColorPainter(FirefoxTheme.colors.layer2), contentDescription, modifier)
}
@Composable
@Preview
private fun DefaultImagePlaceholderPreview() {
FirefoxTheme {
DefaultImagePlaceholder(
Modifier
.size(200.dp, 100.dp)
.clip(RoundedCornerShape(8.dp))
)
}
}