Skip to content

Commit

Permalink
app: ui: player: Show lyrics when pressing specifically on the thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
DD3Boh committed Jun 5, 2024
1 parent ab17261 commit 8d04863
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ fun BottomSheetPlayer(
Thumbnail(
sliderPositionProvider = { sliderPosition },
modifier = Modifier
.nestedScroll(state.preUpPostDownNestedScrollConnection)
.clickable { showLyrics = !showLyrics }
.nestedScroll(state.preUpPostDownNestedScrollConnection),
showLyricsOnClick = true
)
}

Expand Down Expand Up @@ -647,8 +647,8 @@ fun BottomSheetPlayer(
Thumbnail(
sliderPositionProvider = { sliderPosition },
modifier = Modifier
.nestedScroll(state.preUpPostDownNestedScrollConnection)
.clickable { showLyrics = !showLyrics }
.nestedScroll(state.preUpPostDownNestedScrollConnection),
showLyricsOnClick = true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.dd3boh.outertune.ui.player
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -14,6 +15,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
Expand All @@ -33,13 +35,14 @@ import com.dd3boh.outertune.utils.rememberPreference
fun Thumbnail(
sliderPositionProvider: () -> Long?,
modifier: Modifier = Modifier,
showLyricsOnClick: Boolean = false,
) {
val playerConnection = LocalPlayerConnection.current ?: return
val currentView = LocalView.current
val mediaMetadata by playerConnection.mediaMetadata.collectAsState()
val error by playerConnection.error.collectAsState()

val showLyrics by rememberPreference(ShowLyricsKey, false)
var showLyrics by rememberPreference(ShowLyricsKey, defaultValue = false)

DisposableEffect(showLyrics) {
currentView.keepScreenOn = showLyrics
Expand Down Expand Up @@ -73,6 +76,7 @@ fun Thumbnail(
.fillMaxWidth()
.clip(RoundedCornerShape(ThumbnailCornerRadius * 2))
.aspectRatio(ratio = 1f)
.clickable(enabled = showLyricsOnClick) { showLyrics = !showLyrics }
)
}
} else {
Expand All @@ -83,6 +87,7 @@ fun Thumbnail(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(ThumbnailCornerRadius * 2))
.clickable(enabled = showLyricsOnClick) { showLyrics = !showLyrics }
)
}
}
Expand Down

0 comments on commit 8d04863

Please sign in to comment.