mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
UI tweaks
This commit is contained in:
parent
99bddea295
commit
803780894c
5 changed files with 29 additions and 6 deletions
|
|
@ -430,7 +430,7 @@ fun AlbumDetailsPage(
|
||||||
itemsIndexed(state.songs) { index, song ->
|
itemsIndexed(state.songs) { index, song ->
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
contentAlignment = Alignment.TopStart,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
SongListItem(
|
SongListItem(
|
||||||
song = song,
|
song = song,
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
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.draw.clip
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
|
|
@ -463,6 +464,7 @@ fun ArtistDetailsPage(
|
||||||
isQueued = song != null && song.id in currentMusic.queuedIds,
|
isQueued = song != null && song.id in currentMusic.queuedIds,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
|
.align(Alignment.Center)
|
||||||
.fillMaxWidth(.75f)
|
.fillMaxWidth(.75f)
|
||||||
.ifElse(
|
.ifElse(
|
||||||
position.row == SONG_ROW && position.column == index,
|
position.row == SONG_ROW && position.column == index,
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ fun LyricsContent(
|
||||||
if (index == currentLyricPosition || currentLyricPosition == null) {
|
if (index == currentLyricPosition || currentLyricPosition == null) {
|
||||||
MaterialTheme.colorScheme.onSurface
|
MaterialTheme.colorScheme.onSurface
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.onSurface.copy(alpha = .5f)
|
MaterialTheme.colorScheme.onSurface.copy(alpha = .4f)
|
||||||
},
|
},
|
||||||
animationSpec = tween(durationMillis = 500, easing = LinearEasing),
|
animationSpec = tween(durationMillis = 500, easing = LinearEasing),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ fun NowPlayingOverlay(
|
||||||
onMoveQueue: (Int, MoveDirection) -> Unit,
|
onMoveQueue: (Int, MoveDirection) -> Unit,
|
||||||
onClickMoreItem: (Int, AudioItem) -> Unit,
|
onClickMoreItem: (Int, AudioItem) -> Unit,
|
||||||
onClickStop: () -> Unit,
|
onClickStop: () -> Unit,
|
||||||
|
lyricsFocusRequester: FocusRequester,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
@ -116,6 +117,7 @@ fun NowPlayingOverlay(
|
||||||
seekForward = Duration.ZERO,
|
seekForward = Duration.ZERO,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
.padding(top = 8.dp)
|
.padding(top = 8.dp)
|
||||||
.fillMaxWidth(.95f),
|
.fillMaxWidth(.95f),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,9 @@ import androidx.compose.ui.focus.FocusRequester
|
||||||
import androidx.compose.ui.focus.focusRequester
|
import androidx.compose.ui.focus.focusRequester
|
||||||
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.input.key.KeyEventType
|
||||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||||
|
import androidx.compose.ui.input.key.type
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
@ -66,6 +68,7 @@ import com.github.damontecres.wholphin.ui.nav.Backdrop
|
||||||
import com.github.damontecres.wholphin.ui.playback.BottomDialog
|
import com.github.damontecres.wholphin.ui.playback.BottomDialog
|
||||||
import com.github.damontecres.wholphin.ui.playback.BottomDialogItem
|
import com.github.damontecres.wholphin.ui.playback.BottomDialogItem
|
||||||
import com.github.damontecres.wholphin.ui.playback.PlaybackKeyHandler
|
import com.github.damontecres.wholphin.ui.playback.PlaybackKeyHandler
|
||||||
|
import com.github.damontecres.wholphin.ui.playback.isUp
|
||||||
import com.github.damontecres.wholphin.ui.tryRequestFocus
|
import com.github.damontecres.wholphin.ui.tryRequestFocus
|
||||||
import com.github.damontecres.wholphin.util.LoadingState
|
import com.github.damontecres.wholphin.util.LoadingState
|
||||||
import org.jellyfin.sdk.model.extensions.ticks
|
import org.jellyfin.sdk.model.extensions.ticks
|
||||||
|
|
@ -142,6 +145,8 @@ fun NowPlayingPage(
|
||||||
|
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
LaunchedEffect(Unit) { focusRequester.tryRequestFocus() }
|
LaunchedEffect(Unit) { focusRequester.tryRequestFocus() }
|
||||||
|
val lyricsFocusRequester = remember { FocusRequester() }
|
||||||
|
val hasLyrics = musicPrefs.showLyrics && state.hasLyrics
|
||||||
|
|
||||||
LaunchedEffect(lyricsHaveFocus) {
|
LaunchedEffect(lyricsHaveFocus) {
|
||||||
if (lyricsHaveFocus) {
|
if (lyricsHaveFocus) {
|
||||||
|
|
@ -174,8 +179,18 @@ fun NowPlayingPage(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.onPreviewKeyEvent(keyHandler::onKeyEvent)
|
.onPreviewKeyEvent { key ->
|
||||||
.focusRequester(focusRequester)
|
if (!controllerViewState.controlsVisible &&
|
||||||
|
key.type == KeyEventType.KeyUp &&
|
||||||
|
isUp(key) &&
|
||||||
|
hasLyrics
|
||||||
|
) {
|
||||||
|
lyricsFocusRequester.tryRequestFocus()
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
keyHandler.onKeyEvent(key)
|
||||||
|
}
|
||||||
|
}.focusRequester(focusRequester)
|
||||||
.focusable(),
|
.focusable(),
|
||||||
)
|
)
|
||||||
Row(
|
Row(
|
||||||
|
|
@ -212,7 +227,7 @@ fun NowPlayingPage(
|
||||||
model = current?.imageUrl,
|
model = current?.imageUrl,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.size(320.dp)
|
.size(240.dp)
|
||||||
.clip(RoundedCornerShape(16.dp)),
|
.clip(RoundedCornerShape(16.dp)),
|
||||||
)
|
)
|
||||||
current?.title?.let {
|
current?.title?.let {
|
||||||
|
|
@ -260,7 +275,9 @@ fun NowPlayingPage(
|
||||||
visible = musicPrefs.showLyrics && state.hasLyrics,
|
visible = musicPrefs.showLyrics && state.hasLyrics,
|
||||||
enter = expandHorizontally(expandFrom = Alignment.End),
|
enter = expandHorizontally(expandFrom = Alignment.End),
|
||||||
exit = shrinkHorizontally(shrinkTowards = Alignment.End),
|
exit = shrinkHorizontally(shrinkTowards = Alignment.End),
|
||||||
modifier = Modifier,
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.focusRequester(lyricsFocusRequester),
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
|
|
@ -330,8 +347,10 @@ fun NowPlayingPage(
|
||||||
onClickMoreItem = { index, song -> showContextForItem.invoke(false, index, song) },
|
onClickMoreItem = { index, song -> showContextForItem.invoke(false, index, song) },
|
||||||
onLongClickSong = { index, song -> showContextForItem.invoke(true, index, song) },
|
onLongClickSong = { index, song -> showContextForItem.invoke(true, index, song) },
|
||||||
onClickStop = { viewModel.stop() },
|
onClickStop = { viewModel.stop() },
|
||||||
|
lyricsFocusRequester = lyricsFocusRequester,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
.align(Alignment.BottomCenter)
|
.align(Alignment.BottomCenter)
|
||||||
.drawBehind {
|
.drawBehind {
|
||||||
drawRect(
|
drawRect(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue