Minor UI tweaks

This commit is contained in:
vfsfitvnm 2022-10-08 16:02:57 +02:00
parent e59e095266
commit 23dcce88ab
6 changed files with 119 additions and 102 deletions

View file

@ -561,6 +561,7 @@ fun MediaItemMenu(
DialogTextButton(
text = "Set",
enabled = amount > 0,
primary = true,
onClick = {
binder?.startSleepTimer(amount * 10 * 60 * 1000L)
isShowingSleepTimerDialog = false

View file

@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
@ -34,6 +35,8 @@ import androidx.compose.ui.unit.dp
import it.vfsfitvnm.vimusic.LocalPlayerAwareWindowInsets
import it.vfsfitvnm.vimusic.ui.styling.Dimensions
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
import it.vfsfitvnm.vimusic.utils.center
import it.vfsfitvnm.vimusic.utils.color
import it.vfsfitvnm.vimusic.utils.isLandscape
import it.vfsfitvnm.vimusic.utils.semiBold
@ -83,7 +86,11 @@ inline fun NavigationRail(
)
}
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.width(if (isLandscape) Dimensions.navigationRailWidthLandscape else Dimensions.navigationRailWidth)
) {
val transition = updateTransition(targetState = tabIndex, label = null)
content { index, text, icon ->
@ -114,7 +121,7 @@ inline fun NavigationRail(
val textContent: @Composable () -> Unit = {
BasicText(
text = text,
style = typography.xs.semiBold.copy(color = textColor),
style = typography.xs.semiBold.center.color(textColor),
modifier = Modifier
.vertical(enabled = !isLandscape)
.rotate(if (isLandscape) 0f else -90f)
@ -153,7 +160,7 @@ inline fun NavigationRail(
fun Modifier.vertical(enabled: Boolean = true) =
if (enabled)
layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
val placeable = measurable.measure(constraints.copy(maxWidth = Int.MAX_VALUE))
layout(placeable.height, placeable.width) {
placeable.place(
x = -(placeable.width / 2 - placeable.height / 2),

View file

@ -9,7 +9,6 @@ import androidx.compose.animation.core.VisibilityThreshold
import androidx.compose.animation.core.spring
import androidx.compose.animation.with
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
@ -31,13 +30,9 @@ fun Scaffold(
) {
val (colorPalette) = LocalAppearance.current
Box(
modifier = modifier
.background(colorPalette.background0)
.fillMaxSize()
) {
Row(
modifier = modifier
.background(colorPalette.background0)
.fillMaxSize()
) {
NavigationRail(
@ -68,5 +63,4 @@ fun Scaffold(
content = content
)
}
}
}

View file

@ -6,18 +6,20 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.vimusic.Database
import it.vfsfitvnm.vimusic.LocalPlayerAwareWindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.only
import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder
import it.vfsfitvnm.vimusic.R
import it.vfsfitvnm.vimusic.enums.BuiltInPlaylist
@ -93,7 +95,9 @@ fun BuiltInPlaylistSongs(builtInPlaylist: BuiltInPlaylist) {
title = when (builtInPlaylist) {
BuiltInPlaylist.Favorites -> "Favorites"
BuiltInPlaylist.Offline -> "Offline"
}
},
modifier = Modifier
.padding(bottom = 8.dp)
) {
SecondaryTextButton(
text = "Enqueue",

View file

@ -28,6 +28,7 @@ import it.vfsfitvnm.vimusic.LocalPlayerAwareWindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder
import it.vfsfitvnm.vimusic.R
import it.vfsfitvnm.vimusic.models.DetailedSong
@ -151,7 +152,11 @@ fun LocalPlaylistSongs(
key = "header",
contentType = 0
) {
Header(title = playlistWithSongs?.playlist?.name ?: "Unknown") {
Header(
title = playlistWithSongs?.playlist?.name ?: "Unknown",
modifier = Modifier
.padding(bottom = 8.dp)
) {
SecondaryTextButton(
text = "Enqueue",
enabled = playlistWithSongs?.songs?.isNotEmpty() == true,

View file

@ -12,6 +12,7 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
@ -24,6 +25,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@ -296,7 +298,10 @@ fun Lyrics(
colorFilter = ColorFilter.tint(DefaultDarkColorPalette.text),
modifier = Modifier
.padding(all = 4.dp)
.clickable {
.clickable(
indication = rememberRipple(bounded = false),
interactionSource = remember { MutableInteractionSource() },
onClick = {
menuState.display {
Menu {
MenuEntry(
@ -366,6 +371,7 @@ fun Lyrics(
}
}
}
)
.padding(all = 8.dp)
.size(20.dp)
.align(Alignment.BottomEnd)