mirror of
https://github.com/kalarina-bit/Fogwave.git
synced 2026-11-22 08:06:09 +00:00
Load player artwork the same way as the station list
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
package cc.skysparkle.fogwave.ui.components
|
package cc.skysparkle.fogwave.ui.components
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import cc.skysparkle.fogwave.data.model.RadioStation
|
import cc.skysparkle.fogwave.data.model.RadioStation
|
||||||
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
|
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
@@ -19,7 +17,9 @@ private val LightLogoBackdrop = Color(0xFFECE8F1)
|
|||||||
fun stationTileColor(station: RadioStation): Color =
|
fun stationTileColor(station: RadioStation): Color =
|
||||||
if (station.lightBackdrop) LightLogoBackdrop else LocalGeoColors.current.surfaceContainer
|
if (station.lightBackdrop) LightLogoBackdrop else LocalGeoColors.current.surfaceContainer
|
||||||
|
|
||||||
// Station list logos.
|
// Every logo goes through Coil with the size of the box it sits in. Logos live in drawable-nodpi, and a
|
||||||
|
// full-size decode (painterResource, or Coil with Size.ORIGINAL) leaves them blank or a few pixels wide
|
||||||
|
// in release builds, so the mini player and the now-playing sheet load them exactly like the station list.
|
||||||
@Composable
|
@Composable
|
||||||
fun StationLogoImage(station: RadioStation, modifier: Modifier = Modifier) {
|
fun StationLogoImage(station: RadioStation, modifier: Modifier = Modifier) {
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
@@ -30,13 +30,7 @@ fun StationLogoImage(station: RadioStation, modifier: Modifier = Modifier) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mini player, now-playing sheet and its station lists.
|
|
||||||
@Composable
|
@Composable
|
||||||
fun StationArtwork(station: RadioStation, modifier: Modifier = Modifier) {
|
fun StationArtwork(station: RadioStation, modifier: Modifier = Modifier) {
|
||||||
Image(
|
StationLogoImage(station, modifier)
|
||||||
painter = painterResource(id = station.iconResId),
|
|
||||||
contentDescription = null,
|
|
||||||
contentScale = ContentScale.Crop,
|
|
||||||
modifier = modifier
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user