Add SettingsScreen

This commit is contained in:
vfsfitvnm 2022-06-05 12:29:36 +02:00
parent aa7f45dd4a
commit 67cb7d4ba0
4 changed files with 107 additions and 1 deletions

View file

@ -59,6 +59,7 @@ fun HomeScreen(intentVideoId: String?) {
val lazyListState = rememberLazyListState()
val intentVideoRoute = rememberIntentVideoRoute(intentVideoId)
val settingsRoute = rememberSettingsRoute()
val playlistRoute = rememberLocalPlaylistRoute()
val searchRoute = rememberSearchRoute()
val searchResultRoute = rememberSearchResultRoute()
@ -96,6 +97,10 @@ fun HomeScreen(intentVideoId: String?) {
)
}
settingsRoute {
SettingsScreen()
}
playlistRoute { playlistId ->
LocalPlaylistScreen(
playlistId = playlistId ?: error("playlistId cannot be null")
@ -177,8 +182,14 @@ fun HomeScreen(intentVideoId: String?) {
modifier = Modifier
.height(52.dp)
) {
Spacer(
Image(
painter = painterResource(R.drawable.cog),
contentDescription = null,
colorFilter = ColorFilter.tint(colorPalette.text),
modifier = Modifier
.clickable {
settingsRoute()
}
.padding(horizontal = 16.dp, vertical = 8.dp)
.size(24.dp)
)

View file

@ -0,0 +1,79 @@
package it.vfsfitvnm.vimusic.ui.screens
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.*
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.route.RouteHandler
import it.vfsfitvnm.vimusic.R
import it.vfsfitvnm.vimusic.ui.components.TopAppBar
import it.vfsfitvnm.vimusic.ui.styling.LocalColorPalette
import it.vfsfitvnm.vimusic.ui.styling.LocalTypography
import it.vfsfitvnm.vimusic.utils.semiBold
@ExperimentalAnimationApi
@Composable
fun SettingsScreen() {
val albumRoute = rememberAlbumRoute()
val artistRoute = rememberArtistRoute()
val scrollState = rememberScrollState()
RouteHandler(listenToGlobalEmitter = true) {
albumRoute { browseId ->
AlbumScreen(
browseId = browseId ?: error("browseId cannot be null")
)
}
artistRoute { browseId ->
ArtistScreen(
browseId = browseId ?: error("browseId cannot be null")
)
}
host {
val colorPalette = LocalColorPalette.current
val typography = LocalTypography.current
Column(
modifier = Modifier
.padding(bottom = 72.dp)
.background(colorPalette.background)
.fillMaxSize()
.verticalScroll(scrollState)
) {
TopAppBar(
modifier = Modifier
.height(52.dp)
) {
Image(
painter = painterResource(R.drawable.chevron_back),
contentDescription = null,
colorFilter = ColorFilter.tint(colorPalette.text),
modifier = Modifier
.clickable(onClick = pop)
.padding(horizontal = 16.dp, vertical = 8.dp)
.size(24.dp)
)
BasicText(
text = "Settings",
style = typography.m.semiBold
)
Spacer(
modifier = Modifier
.padding(horizontal = 16.dp, vertical = 8.dp)
.size(24.dp)
)
}
}
}
}
}

View file

@ -80,3 +80,10 @@ fun rememberLyricsRoute(): Route0 {
Route0("LyricsRoute")
}
}
@Composable
fun rememberSettingsRoute(): Route0 {
return remember {
Route0("SettingsRoute")
}
}

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:fillColor="#FF000000"
android:pathData="M464,249.93a10.58,10.58 0,0 0,-9.36 -9.94L429,235.84a5.42,5.42 0,0 1,-4.5 -4.67c-0.49,-3.15 -1,-6.42 -1.7,-9.52a5.52,5.52 0,0 1,2.63 -5.85l22.78,-12.65a10.35,10.35 0,0 0,5 -12.83l-3.95,-10.9a10.32,10.32 0,0 0,-12.13 -6.51l-25.55,5a5.51,5.51 0,0 1,-5.82 -2.81c-1.49,-2.79 -3.11,-5.63 -4.8,-8.42a5.6,5.6 0,0 1,0.44 -6.5l17,-19.64a10.42,10.42 0,0 0,0.39 -13.76l-7.42,-8.91a10.24,10.24 0,0 0,-13.58 -2l-22.37,13.43a5.39,5.39 0,0 1,-6.39 -0.63c-2.47,-2.17 -5,-4.26 -7.37,-6.19a5.45,5.45 0,0 1,-1.72 -6.21l9.26,-24.4a10.35,10.35 0,0 0,-4.31 -13.07L354.8,72.91a10.3,10.3 0,0 0,-13.45 2.83L325,96.28A4.6,4.6 0,0 1,319.4 98c-0.61,-0.25 -5.77,-2.36 -9.78,-3.7a5.42,5.42 0,0 1,-3.74 -5.23L306.27,63a10.48,10.48 0,0 0,-8.57 -10.88l-11.45,-2a10.45,10.45 0,0 0,-11.75 7.17L266,82.1a5.46,5.46 0,0 1,-5.36 3.65h-9.75a5.5,5.5 0,0 1,-5.3 -3.67l-8.46,-24.67a10.46,10.46 0,0 0,-11.77 -7.25l-11.47,2a10.46,10.46 0,0 0,-8.56 10.79l0.4,26.16a5.45,5.45 0,0 1,-3.86 5.25c-2.29,0.89 -7.26,2.79 -9.52,3.63 -2,0.72 -4.18,-0.07 -5.94,-2.1l-16.26,-20A10.3,10.3 0,0 0,156.69 73l-10.06,5.83A10.36,10.36 0,0 0,142.31 92l9.25,24.34a5.54,5.54 0,0 1,-1.7 6.23c-2.43,2 -4.92,4 -7.4,6.22a5.38,5.38 0,0 1,-6.35 0.64L114,115.74a10.4,10.4 0,0 0,-13.61 2L93,126.63a10.31,10.31 0,0 0,0.37 13.75L110.45,160a5.42,5.42 0,0 1,0.45 6.45c-1.71,2.72 -3.34,5.58 -4.82,8.44a5.53,5.53 0,0 1,-5.86 2.82l-25.51,-4.93a10.34,10.34 0,0 0,-12.14 6.51l-4,10.88a10.38,10.38 0,0 0,5 12.85l22.78,12.65A5.39,5.39 0,0 1,89 221.59l-0.24,1.27c-0.52,2.79 -1,5.43 -1.46,8.24a5.48,5.48 0,0 1,-4.46 4.64l-25.69,4.15A10.42,10.42 0,0 0,48 250.16v11.58A10.26,10.26 0,0 0,57.16 272l25.68,4.14a5.41,5.41 0,0 1,4.5 4.67c0.49,3.16 1,6.42 1.7,9.52a5.52,5.52 0,0 1,-2.63 5.85L63.64,308.85a10.35,10.35 0,0 0,-5 12.83l4,10.9a10.33,10.33 0,0 0,12.13 6.51l25.55,-4.95a5.49,5.49 0,0 1,5.82 2.81c1.5,2.8 3.11,5.63 4.8,8.42a5.58,5.58 0,0 1,-0.44 6.5l-17,19.63A10.41,10.41 0,0 0,93 385.27l7.41,8.91a10.23,10.23 0,0 0,13.58 2l22.37,-13.43a5.39,5.39 0,0 1,6.39 0.63c2.48,2.17 5,4.26 7.37,6.19a5.47,5.47 0,0 1,1.73 6.21l-9.27,24.4a10.35,10.35 0,0 0,4.31 13.07L157,439.09a10.3,10.3 0,0 0,13.45 -2.82L187,415.92c1.4,-1.73 3.6,-2.5 5.23,-1.84 3.48,1.44 5.81,2.25 9.94,3.63a5.44,5.44 0,0 1,3.75 5.23l-0.4,26.05a10.5,10.5 0,0 0,8.57 10.88l11.45,2a10.43,10.43 0,0 0,11.75 -7.17l8.5,-24.77a5.45,5.45 0,0 1,5.36 -3.65h9.75a5.49,5.49 0,0 1,5.3 3.67l8.47,24.67a10.48,10.48 0,0 0,10 7.41,9.74 9.74,0 0,0 1.78,-0.16l11.47,-2a10.46,10.46 0,0 0,8.56 -10.79l-0.4,-26.16a5.43,5.43 0,0 1,3.75 -5.2c3.84,-1.29 6.54,-2.33 8.91,-3.25l0.6,-0.23c3.1,-1.07 4.6,0.23 5.47,1.31l16.75,20.63A10.3,10.3 0,0 0,355 439l10.07,-5.83a10.35,10.35 0,0 0,4.31 -13.1l-9.24,-24.34a5.52,5.52 0,0 1,1.69 -6.23c2.43,-2 4.92,-4 7.4,-6.22a5.39,5.39 0,0 1,6.38 -0.62L398,396.06a10.39,10.39 0,0 0,13.61 -2l7.4,-8.9a10.31,10.31 0,0 0,-0.37 -13.75l-17.06,-19.67a5.42,5.42 0,0 1,-0.45 -6.45c1.71,-2.71 3.34,-5.57 4.82,-8.44a5.55,5.55 0,0 1,5.86 -2.82L437.29,339a10.34,10.34 0,0 0,12.14 -6.51l3.95,-10.88a10.37,10.37 0,0 0,-5 -12.84L425.58,296.1a5.4,5.4 0,0 1,-2.61 -5.89l0.24,-1.27c0.52,-2.79 1,-5.43 1.46,-8.24a5.48,5.48 0,0 1,4.46 -4.64l25.69,-4.14A10.43,10.43 0,0 0,464 261.64L464,249.93ZM181.55,343.93a15.8,15.8 0,0 1,-25.47 2.66,135.06 135.06,0 0,1 0.42,-181.65A15.81,15.81 0,0 1,182 167.71l45.65,80.35a15.85,15.85 0,0 1,0 15.74ZM256,391.11a134.75,134.75 0,0 1,-28.31 -3,15.81 15.81,0 0,1 -10.23,-23.36l46,-80a15.79,15.79 0,0 1,13.7 -7.93h92.14a15.8,15.8 0,0 1,15.1 20.53C366.91,351.67 316,391.11 256,391.11ZM263.51,227.21L218,147.07a15.81,15.81 0,0 1,10.31 -23.3A134,134 0,0 1,256 120.89c60,0 110.91,39.44 128.37,93.79a15.8,15.8 0,0 1,-15.1 20.53h-92A15.78,15.78 0,0 1,263.51 227.21Z"/>
</vector>