Fix #124
This commit is contained in:
parent
1a98ffeeec
commit
1740943046
1 changed files with 12 additions and 5 deletions
|
@ -3,6 +3,7 @@ package it.vfsfitvnm.vimusic.ui.views
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.text.BasicText
|
import androidx.compose.foundation.text.BasicText
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
@ -11,6 +12,7 @@ import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.ColorFilter
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
|
@ -39,6 +41,7 @@ fun PlaylistPreviewItem(
|
||||||
thumbnailSize: Dp = Dimensions.thumbnails.song
|
thumbnailSize: Dp = Dimensions.thumbnails.song
|
||||||
) {
|
) {
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
|
val (colorPalette, _, thumbnailShape) = LocalAppearance.current
|
||||||
|
|
||||||
val thumbnailSizePx = with(density) {
|
val thumbnailSizePx = with(density) {
|
||||||
thumbnailSize.roundToPx()
|
thumbnailSize.roundToPx()
|
||||||
|
@ -51,7 +54,6 @@ fun PlaylistPreviewItem(
|
||||||
PlaylistItem(
|
PlaylistItem(
|
||||||
name = playlistPreview.playlist.name,
|
name = playlistPreview.playlist.name,
|
||||||
textColor = Color.White,
|
textColor = Color.White,
|
||||||
modifier = modifier,
|
|
||||||
thumbnailSize = thumbnailSize,
|
thumbnailSize = thumbnailSize,
|
||||||
imageContent = {
|
imageContent = {
|
||||||
if (thumbnails.toSet().size == 1) {
|
if (thumbnails.toSet().size == 1) {
|
||||||
|
@ -60,6 +62,7 @@ fun PlaylistPreviewItem(
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.clip(thumbnailShape)
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,13 +81,16 @@ fun PlaylistPreviewItem(
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.clip(thumbnailShape)
|
||||||
|
.border(width = 1.dp, color = colorPalette.lightBackground)
|
||||||
.align(alignment)
|
.align(alignment)
|
||||||
.size(thumbnailSize)
|
.size(thumbnailSize)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +104,6 @@ fun BuiltInPlaylistItem(
|
||||||
) {
|
) {
|
||||||
PlaylistItem(
|
PlaylistItem(
|
||||||
name = name,
|
name = name,
|
||||||
modifier = modifier,
|
|
||||||
thumbnailSize = thumbnailSize,
|
thumbnailSize = thumbnailSize,
|
||||||
withGradient = false,
|
withGradient = false,
|
||||||
imageContent = {
|
imageContent = {
|
||||||
|
@ -110,7 +115,8 @@ fun BuiltInPlaylistItem(
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,10 +129,11 @@ fun PlaylistItem(
|
||||||
withGradient: Boolean = true,
|
withGradient: Boolean = true,
|
||||||
imageContent: @Composable BoxScope.() -> Unit
|
imageContent: @Composable BoxScope.() -> Unit
|
||||||
) {
|
) {
|
||||||
val (colorPalette, typography) = LocalAppearance.current
|
val (colorPalette, typography, thumbnailShape) = LocalAppearance.current
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
|
.clip(thumbnailShape)
|
||||||
.background(colorPalette.lightBackground)
|
.background(colorPalette.lightBackground)
|
||||||
.size(thumbnailSize * 2)
|
.size(thumbnailSize * 2)
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue