mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Restore lyrics position
This commit is contained in:
parent
9f9552f870
commit
e4422375ce
2 changed files with 3 additions and 5 deletions
|
|
@ -39,7 +39,6 @@ import org.jellyfin.sdk.model.api.LyricLine
|
|||
@Composable
|
||||
fun LyricsContent(
|
||||
lyricsHaveFocus: Boolean,
|
||||
synced: Boolean,
|
||||
lyrics: LyricDto?,
|
||||
currentLyricPosition: Int?,
|
||||
onClick: (LyricLine) -> Unit,
|
||||
|
|
@ -50,11 +49,11 @@ fun LyricsContent(
|
|||
remember(lyrics) { List(lyrics?.lyrics.orEmpty().size) { FocusRequester() } }
|
||||
val listState = rememberLazyListState(currentLyricPosition ?: 0)
|
||||
val bringIntoViewRequester = remember { BringIntoViewRequester() }
|
||||
if (synced) {
|
||||
if (!lyricsHaveFocus) {
|
||||
LaunchedEffect(currentLyricPosition) {
|
||||
if (currentLyricPosition != null && !lyricsHaveFocus) {
|
||||
if (currentLyricPosition != null) {
|
||||
listState.layoutInfo.visibleItemsInfo.lastOrNull()?.index?.let {
|
||||
if (currentLyricPosition !in 0..it) {
|
||||
if (currentLyricPosition !in listState.firstVisibleItemIndex..it) {
|
||||
listState.animateScrollToItem(currentLyricPosition)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,7 +220,6 @@ fun NowPlayingPage(
|
|||
.fillMaxHeight(),
|
||||
) {
|
||||
LyricsContent(
|
||||
synced = true,
|
||||
lyrics = state.lyrics,
|
||||
currentLyricPosition = state.currentLyricIndex,
|
||||
lyricsHaveFocus = lyricsHaveFocus,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue