Add dynamic theme (#159)
This commit is contained in:
@@ -59,6 +59,7 @@ import it.vfsfitvnm.vimusic.ui.components.themed.TextPlaceholder
|
||||
import it.vfsfitvnm.vimusic.ui.styling.Dimensions
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||
import it.vfsfitvnm.vimusic.ui.styling.px
|
||||
import it.vfsfitvnm.vimusic.ui.styling.shimmer
|
||||
import it.vfsfitvnm.vimusic.ui.views.SongItem
|
||||
import it.vfsfitvnm.vimusic.utils.asMediaItem
|
||||
import it.vfsfitvnm.vimusic.utils.bold
|
||||
@@ -110,7 +111,7 @@ fun AlbumScreen(browseId: String) {
|
||||
state = lazyListState,
|
||||
contentPadding = PaddingValues(bottom = 72.dp),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item {
|
||||
@@ -377,7 +378,7 @@ private fun LoadingOrError(
|
||||
) {
|
||||
Spacer(
|
||||
modifier = Modifier
|
||||
.background(color = colorPalette.darkGray, shape = ThumbnailRoundness.shape)
|
||||
.background(color = colorPalette.shimmer, shape = ThumbnailRoundness.shape)
|
||||
.size(Dimensions.thumbnails.album)
|
||||
)
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.center
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
@@ -53,6 +54,7 @@ import it.vfsfitvnm.vimusic.ui.components.themed.TextPlaceholder
|
||||
import it.vfsfitvnm.vimusic.ui.styling.Dimensions
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||
import it.vfsfitvnm.vimusic.ui.styling.px
|
||||
import it.vfsfitvnm.vimusic.ui.styling.shimmer
|
||||
import it.vfsfitvnm.vimusic.ui.views.SongItem
|
||||
import it.vfsfitvnm.vimusic.utils.asMediaItem
|
||||
import it.vfsfitvnm.vimusic.utils.forcePlayAtIndex
|
||||
@@ -102,7 +104,7 @@ fun ArtistScreen(browseId: String) {
|
||||
contentPadding = PaddingValues(bottom = 72.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item {
|
||||
@@ -213,7 +215,7 @@ fun ArtistScreen(browseId: String) {
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.zIndex(1f)
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp)
|
||||
@@ -271,7 +273,7 @@ fun ArtistScreen(browseId: String) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp)
|
||||
.padding(top = 32.dp)
|
||||
@@ -295,14 +297,14 @@ fun ArtistScreen(browseId: String) {
|
||||
.width(48.dp)
|
||||
) {
|
||||
drawLine(
|
||||
color = colorPalette.backgroundContainer,
|
||||
color = colorPalette.background2,
|
||||
start = size.center.copy(y = 0f),
|
||||
end = size.center.copy(y = size.height),
|
||||
strokeWidth = 2.dp.toPx()
|
||||
)
|
||||
|
||||
drawCircle(
|
||||
color = colorPalette.backgroundContainer,
|
||||
color = colorPalette.background2,
|
||||
center = size.center.copy(y = size.height),
|
||||
radius = 4.dp.toPx()
|
||||
)
|
||||
@@ -340,7 +342,7 @@ private fun LoadingOrError(
|
||||
) {
|
||||
Spacer(
|
||||
modifier = Modifier
|
||||
.background(color = colorPalette.darkGray, shape = CircleShape)
|
||||
.background(color = colorPalette.shimmer, shape = CircleShape)
|
||||
.size(Dimensions.thumbnails.artist)
|
||||
)
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ fun BuiltInPlaylistScreen(builtInPlaylist: BuiltInPlaylist) {
|
||||
state = lazyListState,
|
||||
contentPadding = PaddingValues(bottom = Dimensions.collapsedPlayer),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item {
|
||||
|
||||
@@ -38,25 +38,15 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.draw.drawWithCache
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.center
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.ClipOp
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.Paint
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.Shadow
|
||||
import androidx.compose.ui.graphics.asAndroidPath
|
||||
import androidx.compose.ui.graphics.drawscope.clipPath
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.zIndex
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import it.vfsfitvnm.route.RouteHandler
|
||||
import it.vfsfitvnm.vimusic.Database
|
||||
import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder
|
||||
@@ -79,6 +69,8 @@ import it.vfsfitvnm.vimusic.ui.components.themed.InHistoryMediaItemMenu
|
||||
import it.vfsfitvnm.vimusic.ui.components.themed.TextFieldDialog
|
||||
import it.vfsfitvnm.vimusic.ui.styling.Dimensions
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||
import it.vfsfitvnm.vimusic.ui.styling.onOverlay
|
||||
import it.vfsfitvnm.vimusic.ui.styling.overlay
|
||||
import it.vfsfitvnm.vimusic.ui.styling.px
|
||||
import it.vfsfitvnm.vimusic.ui.views.BuiltInPlaylistItem
|
||||
import it.vfsfitvnm.vimusic.ui.views.PlaylistPreviewItem
|
||||
@@ -186,7 +178,6 @@ fun HomeScreen() {
|
||||
@Suppress("UNUSED_EXPRESSION") playlistPreviews
|
||||
@Suppress("UNUSED_EXPRESSION") songCollection
|
||||
|
||||
val context = LocalContext.current
|
||||
val binder = LocalPlayerServiceBinder.current
|
||||
|
||||
val isFirstLaunch by rememberPreference(isFirstLaunchKey, true)
|
||||
@@ -215,7 +206,7 @@ fun HomeScreen() {
|
||||
state = lazyListState,
|
||||
contentPadding = PaddingValues(bottom = 72.dp),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item("topAppBar") {
|
||||
@@ -228,22 +219,20 @@ fun HomeScreen() {
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.text),
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
settingsRoute()
|
||||
}
|
||||
.clickable { settingsRoute() }
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||
.run {
|
||||
if (isFirstLaunch) {
|
||||
drawBehind {
|
||||
drawCircle(
|
||||
color = colorPalette.red,
|
||||
color = colorPalette.accent,
|
||||
center = Offset(
|
||||
x = size.width,
|
||||
y = 0.dp.toPx()
|
||||
),
|
||||
radius = 4.dp.toPx(),
|
||||
shadow = Shadow(
|
||||
color = colorPalette.red,
|
||||
color = colorPalette.accent,
|
||||
blurRadius = 4.dp.toPx()
|
||||
)
|
||||
)
|
||||
@@ -255,88 +244,12 @@ fun HomeScreen() {
|
||||
.size(24.dp)
|
||||
)
|
||||
|
||||
BasicText(
|
||||
text = "ViMusic",
|
||||
style = typography.l.semiBold,
|
||||
modifier = Modifier
|
||||
.drawWithCache {
|
||||
val decorationPath = Path().apply {
|
||||
with(asAndroidPath()) {
|
||||
addCircle(
|
||||
8.dp.toPx(),
|
||||
size.center.y,
|
||||
16.dp.toPx(),
|
||||
android.graphics.Path.Direction.CCW
|
||||
)
|
||||
addCircle(
|
||||
32.dp.toPx(),
|
||||
-2.dp.toPx(),
|
||||
8.dp.toPx(),
|
||||
android.graphics.Path.Direction.CCW
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (colorPalette.isDark) {
|
||||
return@drawWithCache onDrawBehind {
|
||||
drawPath(
|
||||
path = decorationPath,
|
||||
color = colorPalette.primaryContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val textPaint = Paint()
|
||||
.asFrameworkPaint()
|
||||
.apply {
|
||||
isAntiAlias = true
|
||||
textSize = typography.l.fontSize.toPx()
|
||||
color = colorPalette.text.toArgb()
|
||||
typeface = ResourcesCompat.getFont(
|
||||
context,
|
||||
R.font.poppins_w500
|
||||
)
|
||||
textAlign = android.graphics.Paint.Align.CENTER
|
||||
}
|
||||
|
||||
val textY =
|
||||
((textPaint.fontMetrics.descent - textPaint.fontMetrics.ascent) / 2) - textPaint.fontMetrics.descent
|
||||
|
||||
val textPath = Path().apply {
|
||||
textPaint.getTextPath(
|
||||
"ViMusic",
|
||||
0,
|
||||
7,
|
||||
size.width / 2,
|
||||
size.height / 2 + textY,
|
||||
asAndroidPath()
|
||||
)
|
||||
}
|
||||
|
||||
onDrawWithContent {
|
||||
clipPath(textPath, ClipOp.Difference) {
|
||||
drawPath(
|
||||
path = decorationPath,
|
||||
color = colorPalette.primaryContainer
|
||||
)
|
||||
}
|
||||
|
||||
clipPath(decorationPath, ClipOp.Difference) {
|
||||
this@onDrawWithContent.drawContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(horizontal = 8.dp)
|
||||
)
|
||||
|
||||
Image(
|
||||
painter = painterResource(R.drawable.search),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.text),
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
searchRoute("")
|
||||
}
|
||||
.clickable { searchRoute("") }
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||
.size(24.dp)
|
||||
)
|
||||
@@ -364,9 +277,7 @@ fun HomeScreen() {
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.text),
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
isCreatingANewPlaylist = true
|
||||
}
|
||||
.clickable { isCreatingANewPlaylist = true }
|
||||
.padding(all = 8.dp)
|
||||
.size(20.dp)
|
||||
)
|
||||
@@ -381,18 +292,14 @@ fun HomeScreen() {
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.text),
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
isSortMenuDisplayed = true
|
||||
}
|
||||
.clickable { isSortMenuDisplayed = true }
|
||||
.padding(horizontal = 8.dp, vertical = 8.dp)
|
||||
.size(20.dp)
|
||||
)
|
||||
|
||||
DropdownMenu(
|
||||
isDisplayed = isSortMenuDisplayed,
|
||||
onDismissRequest = {
|
||||
isSortMenuDisplayed = false
|
||||
}
|
||||
onDismissRequest = { isSortMenuDisplayed = false }
|
||||
) {
|
||||
DropDownSection {
|
||||
DropDownTextItem(
|
||||
@@ -520,7 +427,7 @@ fun HomeScreen() {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.zIndex(1f)
|
||||
.padding(horizontal = 8.dp)
|
||||
.padding(top = 32.dp)
|
||||
@@ -649,17 +556,14 @@ fun HomeScreen() {
|
||||
) {
|
||||
BasicText(
|
||||
text = song.formattedTotalPlayTime,
|
||||
style = typography.xxs.semiBold.center.color(Color.White),
|
||||
style = typography.xxs.semiBold.center.color(colorPalette.onOverlay),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(
|
||||
brush = Brush.verticalGradient(
|
||||
colors = listOf(
|
||||
Color.Transparent,
|
||||
Color.Black.copy(alpha = 0.75f)
|
||||
)
|
||||
colors = listOf(Color.Transparent, colorPalette.overlay)
|
||||
),
|
||||
shape = ThumbnailRoundness.shape
|
||||
)
|
||||
|
||||
@@ -146,7 +146,7 @@ fun IntentUriScreen(uri: Uri) {
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
contentPadding = PaddingValues(bottom = Dimensions.collapsedPlayer),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item {
|
||||
|
||||
@@ -128,7 +128,7 @@ fun LocalPlaylistScreen(playlistId: Long) {
|
||||
state = lazyListState,
|
||||
contentPadding = PaddingValues(bottom = Dimensions.collapsedPlayer),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item {
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@@ -59,6 +60,7 @@ import it.vfsfitvnm.vimusic.ui.components.themed.TextPlaceholder
|
||||
import it.vfsfitvnm.vimusic.ui.styling.Dimensions
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||
import it.vfsfitvnm.vimusic.ui.styling.px
|
||||
import it.vfsfitvnm.vimusic.ui.styling.shimmer
|
||||
import it.vfsfitvnm.vimusic.ui.views.SongItem
|
||||
import it.vfsfitvnm.vimusic.utils.bold
|
||||
import it.vfsfitvnm.vimusic.utils.center
|
||||
@@ -109,7 +111,7 @@ fun PlaylistScreen(browseId: String) {
|
||||
state = lazyListState,
|
||||
contentPadding = PaddingValues(bottom = 72.dp),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item {
|
||||
@@ -396,7 +398,7 @@ private fun LoadingOrError(
|
||||
) {
|
||||
Spacer(
|
||||
modifier = Modifier
|
||||
.background(color = colorPalette.darkGray, shape = ThumbnailRoundness.shape)
|
||||
.background(color = colorPalette.shimmer, shape = ThumbnailRoundness.shape)
|
||||
.size(Dimensions.thumbnails.playlist)
|
||||
)
|
||||
|
||||
@@ -434,7 +436,7 @@ private fun LoadingOrError(
|
||||
Spacer(
|
||||
modifier = Modifier
|
||||
.size(8.dp)
|
||||
.background(color = colorPalette.darkGray, shape = CircleShape)
|
||||
.background(color = Color.Black, shape = CircleShape)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ import it.vfsfitvnm.vimusic.ui.components.themed.TextPlaceholder
|
||||
import it.vfsfitvnm.vimusic.ui.styling.Dimensions
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||
import it.vfsfitvnm.vimusic.ui.styling.px
|
||||
import it.vfsfitvnm.vimusic.ui.styling.shimmer
|
||||
import it.vfsfitvnm.vimusic.ui.views.SongItem
|
||||
import it.vfsfitvnm.vimusic.utils.asMediaItem
|
||||
import it.vfsfitvnm.vimusic.utils.center
|
||||
@@ -129,7 +130,7 @@ fun SearchResultScreen(query: String, onSearchAgain: () -> Unit) {
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
contentPadding = PaddingValues(bottom = Dimensions.collapsedPlayer),
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
item {
|
||||
@@ -200,9 +201,9 @@ fun SearchResultScreen(query: String, onSearchAgain: () -> Unit) {
|
||||
),
|
||||
),
|
||||
value = searchFilter,
|
||||
selectedBackgroundColor = colorPalette.primaryContainer,
|
||||
unselectedBackgroundColor = colorPalette.lightBackground,
|
||||
selectedTextStyle = typography.xs.medium.color(colorPalette.onPrimaryContainer),
|
||||
selectedBackgroundColor = colorPalette.accent,
|
||||
unselectedBackgroundColor = colorPalette.background1,
|
||||
selectedTextStyle = typography.xs.medium.color(colorPalette.onAccent),
|
||||
unselectedTextStyle = typography.xs.medium,
|
||||
shape = RoundedCornerShape(36.dp),
|
||||
onValueChanged = {
|
||||
@@ -281,7 +282,7 @@ fun SmallSongItemShimmer(
|
||||
thumbnailSizeDp: Dp,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val (colorPalette) = LocalAppearance.current
|
||||
val (colorPalette, _, thumbnailShape) = LocalAppearance.current
|
||||
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
@@ -290,7 +291,7 @@ fun SmallSongItemShimmer(
|
||||
) {
|
||||
Spacer(
|
||||
modifier = Modifier
|
||||
.background(color = colorPalette.darkGray, shape = ThumbnailRoundness.shape)
|
||||
.background(color = colorPalette.shimmer, shape = thumbnailShape)
|
||||
.size(thumbnailSizeDp)
|
||||
)
|
||||
|
||||
@@ -315,7 +316,7 @@ fun SmallArtistItemShimmer(
|
||||
) {
|
||||
Spacer(
|
||||
modifier = Modifier
|
||||
.background(color = colorPalette.darkGray, shape = CircleShape)
|
||||
.background(color = colorPalette.shimmer, shape = CircleShape)
|
||||
.size(thumbnailSizeDp)
|
||||
)
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.res.painterResource
|
||||
@@ -194,7 +195,7 @@ fun SearchScreen(initialTextInput: String, onSearch: (String) -> Unit, onUri: (U
|
||||
}
|
||||
.padding(horizontal = 14.dp, vertical = 6.dp)
|
||||
.background(
|
||||
color = colorPalette.lightBackground,
|
||||
color = colorPalette.background1,
|
||||
shape = CircleShape
|
||||
)
|
||||
.size(28.dp)
|
||||
@@ -228,13 +229,13 @@ fun SearchScreen(initialTextInput: String, onSearch: (String) -> Unit, onUri: (U
|
||||
}
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.background(colorPalette.lightBackground)
|
||||
.background(colorPalette.background1)
|
||||
.padding(vertical = 16.dp, horizontal = 8.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(R.drawable.link),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.darkGray),
|
||||
colorFilter = ColorFilter.tint( Color.Black),
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 8.dp)
|
||||
.size(20.dp)
|
||||
@@ -262,17 +263,16 @@ fun SearchScreen(initialTextInput: String, onSearch: (String) -> Unit, onUri: (U
|
||||
modifier = Modifier
|
||||
.clickable(
|
||||
indication = rememberRipple(bounded = true),
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
onSearch(searchQuery.query)
|
||||
}
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = { onSearch(searchQuery.query) }
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp, horizontal = 8.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(R.drawable.time),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.darkGray),
|
||||
colorFilter = ColorFilter.tint(colorPalette.textDisabled),
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 8.dp)
|
||||
.size(20.dp)
|
||||
@@ -289,7 +289,7 @@ fun SearchScreen(initialTextInput: String, onSearch: (String) -> Unit, onUri: (U
|
||||
Image(
|
||||
painter = painterResource(R.drawable.close),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.darkGray),
|
||||
colorFilter = ColorFilter.tint(colorPalette.textDisabled),
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
query {
|
||||
@@ -303,7 +303,7 @@ fun SearchScreen(initialTextInput: String, onSearch: (String) -> Unit, onUri: (U
|
||||
Image(
|
||||
painter = painterResource(R.drawable.arrow_forward),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.darkGray),
|
||||
colorFilter = ColorFilter.tint(colorPalette.textDisabled),
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
textFieldValue = TextFieldValue(
|
||||
@@ -325,10 +325,9 @@ fun SearchScreen(initialTextInput: String, onSearch: (String) -> Unit, onUri: (U
|
||||
modifier = Modifier
|
||||
.clickable(
|
||||
indication = rememberRipple(bounded = true),
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
onSearch(suggestion)
|
||||
}
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = { onSearch(suggestion) }
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp, horizontal = 8.dp)
|
||||
) {
|
||||
@@ -346,11 +345,10 @@ fun SearchScreen(initialTextInput: String, onSearch: (String) -> Unit, onUri: (U
|
||||
.weight(1f)
|
||||
)
|
||||
|
||||
|
||||
Image(
|
||||
painter = painterResource(R.drawable.arrow_forward),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.darkGray),
|
||||
colorFilter = ColorFilter.tint(Color.Black),
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
textFieldValue = TextFieldValue(
|
||||
|
||||
@@ -76,7 +76,7 @@ fun SettingsScreen() {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(bottom = 72.dp)
|
||||
@@ -137,10 +137,10 @@ fun SettingsScreen() {
|
||||
Image(
|
||||
painter = painterResource(icon),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(colorPalette.background),
|
||||
colorFilter = ColorFilter.tint(colorPalette.text),
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.size(18.dp)
|
||||
.size(16.dp)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -166,11 +166,11 @@ fun SettingsScreen() {
|
||||
.size(8.dp)
|
||||
) {
|
||||
drawCircle(
|
||||
color = colorPalette.red,
|
||||
color = colorPalette.accent,
|
||||
center = size.center.copy(x = size.width),
|
||||
radius = 4.dp.toPx(),
|
||||
shadow = Shadow(
|
||||
color = colorPalette.red,
|
||||
color = colorPalette.accent,
|
||||
blurRadius = 4.dp.toPx()
|
||||
)
|
||||
)
|
||||
@@ -180,7 +180,7 @@ fun SettingsScreen() {
|
||||
}
|
||||
|
||||
Entry(
|
||||
color = colorPalette.magenta,
|
||||
color = colorPalette.background2,
|
||||
icon = R.drawable.color_palette,
|
||||
title = "Appearance",
|
||||
description = "Change the colors and shapes",
|
||||
@@ -188,7 +188,7 @@ fun SettingsScreen() {
|
||||
)
|
||||
|
||||
Entry(
|
||||
color = colorPalette.blue,
|
||||
color = colorPalette.background2,
|
||||
icon = R.drawable.play,
|
||||
title = "Player & Audio",
|
||||
description = "Player and audio settings",
|
||||
@@ -196,7 +196,7 @@ fun SettingsScreen() {
|
||||
)
|
||||
|
||||
Entry(
|
||||
color = colorPalette.cyan,
|
||||
color = colorPalette.background2,
|
||||
icon = R.drawable.server,
|
||||
title = "Cache",
|
||||
description = "Manage the used space",
|
||||
@@ -204,7 +204,7 @@ fun SettingsScreen() {
|
||||
)
|
||||
|
||||
Entry(
|
||||
color = colorPalette.orange,
|
||||
color = colorPalette.background2,
|
||||
icon = R.drawable.save,
|
||||
title = "Backup & Restore",
|
||||
description = "Backup and restore the database",
|
||||
@@ -212,7 +212,7 @@ fun SettingsScreen() {
|
||||
)
|
||||
|
||||
Entry(
|
||||
color = colorPalette.green,
|
||||
color = colorPalette.background2,
|
||||
icon = R.drawable.shapes,
|
||||
title = "Other",
|
||||
description = "Advanced settings",
|
||||
@@ -224,7 +224,7 @@ fun SettingsScreen() {
|
||||
)
|
||||
|
||||
Entry(
|
||||
color = colorPalette.magenta,
|
||||
color = colorPalette.background2,
|
||||
icon = R.drawable.information,
|
||||
title = "About",
|
||||
description = "App version and social links",
|
||||
@@ -241,6 +241,7 @@ inline fun <reified T : Enum<T>> EnumValueSelectorSettingsEntry(
|
||||
selectedValue: T,
|
||||
crossinline onValueSelected: (T) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
isEnabled: Boolean = true,
|
||||
crossinline valueText: (T) -> String = Enum<T>::name
|
||||
) {
|
||||
ValueSelectorSettingsEntry(
|
||||
@@ -249,6 +250,7 @@ inline fun <reified T : Enum<T>> EnumValueSelectorSettingsEntry(
|
||||
values = enumValues<T>().toList(),
|
||||
onValueSelected = onValueSelected,
|
||||
modifier = modifier,
|
||||
isEnabled = isEnabled,
|
||||
valueText = valueText
|
||||
)
|
||||
}
|
||||
@@ -260,6 +262,7 @@ inline fun <T> ValueSelectorSettingsEntry(
|
||||
values: List<T>,
|
||||
crossinline onValueSelected: (T) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
isEnabled: Boolean = true,
|
||||
crossinline valueText: (T) -> String = { it.toString() }
|
||||
) {
|
||||
var isShowingDialog by remember {
|
||||
@@ -283,6 +286,7 @@ inline fun <T> ValueSelectorSettingsEntry(
|
||||
title = title,
|
||||
text = valueText(selectedValue),
|
||||
modifier = modifier,
|
||||
isEnabled = isEnabled,
|
||||
onClick = {
|
||||
isShowingDialog = true
|
||||
}
|
||||
@@ -428,7 +432,7 @@ fun SettingsEntryGroupText(
|
||||
|
||||
BasicText(
|
||||
text = title.uppercase(),
|
||||
style = typography.xxs.semiBold.copy(colorPalette.blue),
|
||||
style = typography.xxs.semiBold.copy(colorPalette.accent),
|
||||
modifier = modifier
|
||||
.padding(start = 24.dp, top = 24.dp)
|
||||
.padding(horizontal = 32.dp)
|
||||
|
||||
@@ -42,7 +42,7 @@ fun AboutScreen() {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(bottom = 72.dp)
|
||||
|
||||
@@ -21,6 +21,7 @@ import androidx.compose.ui.unit.dp
|
||||
import it.vfsfitvnm.route.RouteHandler
|
||||
import it.vfsfitvnm.vimusic.R
|
||||
import it.vfsfitvnm.vimusic.enums.ColorPaletteMode
|
||||
import it.vfsfitvnm.vimusic.enums.ColorPaletteName
|
||||
import it.vfsfitvnm.vimusic.enums.ThumbnailRoundness
|
||||
import it.vfsfitvnm.vimusic.ui.components.TopAppBar
|
||||
import it.vfsfitvnm.vimusic.ui.screens.EnumValueSelectorSettingsEntry
|
||||
@@ -30,6 +31,7 @@ import it.vfsfitvnm.vimusic.ui.screens.SwitchSettingEntry
|
||||
import it.vfsfitvnm.vimusic.ui.screens.globalRoutes
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||
import it.vfsfitvnm.vimusic.utils.colorPaletteModeKey
|
||||
import it.vfsfitvnm.vimusic.utils.colorPaletteNameKey
|
||||
import it.vfsfitvnm.vimusic.utils.isShowingThumbnailInLockscreenKey
|
||||
import it.vfsfitvnm.vimusic.utils.rememberPreference
|
||||
import it.vfsfitvnm.vimusic.utils.thumbnailRoundnessKey
|
||||
@@ -45,6 +47,7 @@ fun AppearanceSettingsScreen() {
|
||||
host {
|
||||
val (colorPalette) = LocalAppearance.current
|
||||
|
||||
var colorPaletteName by rememberPreference(colorPaletteNameKey, ColorPaletteName.Dynamic)
|
||||
var colorPaletteMode by rememberPreference(colorPaletteModeKey, ColorPaletteMode.System)
|
||||
var thumbnailRoundness by rememberPreference(
|
||||
thumbnailRoundnessKey,
|
||||
@@ -57,7 +60,7 @@ fun AppearanceSettingsScreen() {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(bottom = 72.dp)
|
||||
@@ -81,9 +84,18 @@ fun AppearanceSettingsScreen() {
|
||||
|
||||
SettingsEntryGroupText(title = "COLORS")
|
||||
|
||||
EnumValueSelectorSettingsEntry(
|
||||
title = "Theme",
|
||||
selectedValue = colorPaletteName,
|
||||
onValueSelected = {
|
||||
colorPaletteName = it
|
||||
}
|
||||
)
|
||||
|
||||
EnumValueSelectorSettingsEntry(
|
||||
title = "Theme mode",
|
||||
selectedValue = colorPaletteMode,
|
||||
isEnabled = colorPaletteName != ColorPaletteName.PureBlack,
|
||||
onValueSelected = {
|
||||
colorPaletteMode = it
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ fun BackupAndRestoreScreen() {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(bottom = 72.dp)
|
||||
|
||||
@@ -67,7 +67,7 @@ fun CacheSettingsScreen() {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(bottom = 72.dp)
|
||||
|
||||
@@ -71,7 +71,7 @@ fun OtherSettingsScreen() {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(bottom = 72.dp)
|
||||
|
||||
@@ -63,7 +63,7 @@ fun PlayerSettingsScreen() {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(colorPalette.background)
|
||||
.background(colorPalette.background0)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(bottom = 72.dp)
|
||||
|
||||
Reference in New Issue
Block a user