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")
}
}