Improve StreamThumbnail composable

This commit is contained in:
Isira Seneviratne 2024-07-29 18:33:10 +05:30
parent 2f9364a2cf
commit 75475da053
4 changed files with 6 additions and 5 deletions

View File

@ -41,8 +41,8 @@ fun StreamCardItem(
.padding(top = 12.dp, start = 2.dp, end = 2.dp)
) {
StreamThumbnail(
modifier = Modifier.fillMaxWidth(),
stream = stream,
modifier = Modifier.fillMaxWidth(),
contentScale = ContentScale.FillWidth
)

View File

@ -41,7 +41,7 @@ fun StreamGridItem(
) {
val size = if (isMini) DpSize(150.dp, 85.dp) else DpSize(246.dp, 138.dp)
StreamThumbnail(modifier = Modifier.size(size), stream = stream)
StreamThumbnail(stream = stream, modifier = Modifier.size(size))
Text(
text = stream.name,

View File

@ -45,8 +45,8 @@ fun StreamListItem(
verticalAlignment = Alignment.CenterVertically
) {
StreamThumbnail(
modifier = Modifier.size(width = 98.dp, height = 55.dp),
stream = stream
stream = stream,
modifier = Modifier.size(width = 98.dp, height = 55.dp)
)
Column {

View File

@ -22,8 +22,8 @@ import org.schabi.newpipe.util.image.ImageStrategy
@Composable
fun StreamThumbnail(
modifier: Modifier = Modifier,
stream: StreamInfoItem,
modifier: Modifier = Modifier,
contentScale: ContentScale = ContentScale.Fit
) {
Box(modifier = modifier, contentAlignment = Alignment.BottomEnd) {
@ -49,6 +49,7 @@ fun StreamThumbnail(
modifier = Modifier
.padding(2.dp)
.background(background.copy(alpha = 0.5f))
.padding(2.dp)
)
}
}