Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ data class MiscSettings(
val systemEffectsMode: Boolean = false,
/** When true, shows floating button now playing instead of the bottom mini player card (Settings -> Experimental). */
val buttonNowPlayingEnabled: Boolean = false,
/** Opt-in: show the active synced lyric line above the progress bar on Now Playing. */
val nowPlayingMiniLyricsEnabled: Boolean = false,
/** When true, shows synced music video option in the Now Playing menu (Settings -> Experimental). On by default. */
val musicVideoEnabled: Boolean = true,
val musicVideoFullBleed: Boolean = false,
Expand Down Expand Up @@ -585,6 +587,7 @@ class SettingsPreferences @Inject constructor(
val STORAGE_CACHE_LAST_CLEAR_FREED_BYTES = longPreferencesKey("lw_storage_cache_last_clear_freed_bytes")
val SYSTEM_EFFECTS_MODE = booleanPreferencesKey("lw_system_effects_mode")
val BUTTON_NOW_PLAYING_ENABLED = booleanPreferencesKey("lw_button_now_playing_enabled")
val NOW_PLAYING_MINI_LYRICS_ENABLED = booleanPreferencesKey("lw_now_playing_mini_lyrics_enabled")
val MUSIC_VIDEO_ENABLED = booleanPreferencesKey("lw_music_video_enabled")
val MUSIC_VIDEO_FULL_BLEED = booleanPreferencesKey("lw_music_video_full_bleed")
val NOW_PLAYING_DESIGN = stringPreferencesKey("lw_now_playing_design")
Expand Down Expand Up @@ -672,6 +675,7 @@ class SettingsPreferences @Inject constructor(
downloadQuality = p.readSafely(Keys.DOWNLOAD_QUALITY)?.takeIf { it in DOWNLOAD_QUALITIES } ?: 27,
systemEffectsMode = p.readSafely(Keys.SYSTEM_EFFECTS_MODE) ?: false,
buttonNowPlayingEnabled = p.readSafely(Keys.BUTTON_NOW_PLAYING_ENABLED) ?: false,
nowPlayingMiniLyricsEnabled = p.readSafely(Keys.NOW_PLAYING_MINI_LYRICS_ENABLED) ?: false,
musicVideoEnabled = p.readSafely(Keys.MUSIC_VIDEO_ENABLED) ?: true,
musicVideoFullBleed = p.readSafely(Keys.MUSIC_VIDEO_FULL_BLEED) ?: false,
nowPlayingDesign = NowPlayingDesign.fromId(p.readSafely(Keys.NOW_PLAYING_DESIGN)),
Expand Down Expand Up @@ -1097,6 +1101,10 @@ class SettingsPreferences @Inject constructor(
dataStore.edit { it[Keys.BUTTON_NOW_PLAYING_ENABLED] = enabled }
}

suspend fun setNowPlayingMiniLyricsEnabled(enabled: Boolean) {
dataStore.edit { it[Keys.NOW_PLAYING_MINI_LYRICS_ENABLED] = enabled }
}

suspend fun setStudioMasterClarity(enabled: Boolean) {
dataStore.edit { it[Keys.MUSIC_ENHANCER] = enabled }
}
Expand Down
46 changes: 42 additions & 4 deletions app/src/main/java/com/lastwave/app/ui/player/FullPlayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ internal fun FullPlayer(
lyricsButtonsAutoHideSeconds: Int = 5,
/** Language the lyric translate button targets; blank = app language. */
translationLanguage: String = "",
nowPlayingMiniLyricsEnabled: Boolean = false,
canvas: com.lastwave.app.data.canvas.CanvasArtwork? = null,
canvasEnabled: Boolean = true,
canvasFullBleedEnabled: Boolean = true,
Expand Down Expand Up @@ -1448,6 +1449,9 @@ internal fun FullPlayer(
state = state,
player = player,
progressState = progressState,
lyricsState = lyricsState,
lyricsOffsetMs = lyricsOffsetMs,
nowPlayingMiniLyricsEnabled = nowPlayingMiniLyricsEnabled,
seekbarStyle = seekbarStyle,
nowPlayingDesign = nowPlayingDesign,
wavySeekbarEnabled = wavySeekbarEnabled,
Expand Down Expand Up @@ -1862,12 +1866,35 @@ internal fun FullPlayer(
}
}
}
Spacer(Modifier.height(4.dp))
var miniLyricsVisible by remember { mutableStateOf(false) }
val miniLyricsShowing = nowPlayingMiniLyricsEnabled && !playerLyricsActive && miniLyricsVisible
val miniLyricsLayoutDuration = if (miniLyricsShowing) 220 else 180
val artworkBottomGap by animateDpAsState(
targetValue = if (miniLyricsShowing) 12.dp else 4.dp,
animationSpec = tween(miniLyricsLayoutDuration, easing = FastOutSlowInEasing),
label = "miniLyricsArtworkGap",
)
val controlsTranslationY by animateDpAsState(
targetValue = if (miniLyricsShowing) 0.dp else (-14).dp,
animationSpec = tween(miniLyricsLayoutDuration, easing = FastOutSlowInEasing),
label = "miniLyricsControlsTranslationY",
)
val miniLyricsTopGap by animateDpAsState(
targetValue = if (miniLyricsShowing) 6.dp else 10.dp,
animationSpec = tween(miniLyricsLayoutDuration, easing = FastOutSlowInEasing),
label = "miniLyricsTopGap",
)
val utilityControlsGap by animateDpAsState(
targetValue = if (miniLyricsShowing) 18.dp else 30.dp,
animationSpec = tween(miniLyricsLayoutDuration, easing = FastOutSlowInEasing),
label = "miniLyricsUtilityGap",
)
Spacer(Modifier.height(artworkBottomGap))
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = if (isVideoActive) 20.dp else 0.dp)
.graphicsLayer { translationY = -14.dp.toPx() },
.graphicsLayer { translationY = controlsTranslationY.toPx() },
horizontalAlignment = Alignment.CenterHorizontally,
) {
Row(
Expand Down Expand Up @@ -2003,7 +2030,18 @@ internal fun FullPlayer(
}
}
}
Spacer(Modifier.height(10.dp))
Spacer(Modifier.height(miniLyricsTopGap))
NowPlayingMiniLyrics(
enabled = nowPlayingMiniLyricsEnabled && !playerLyricsActive,
trackKey = lyricsTrackKey(track),
lyricsState = lyricsState,
progressState = progressState,
isPlaying = state.isPlaying,
lyricsOffsetMs = lyricsOffsetMs,
onOpenFullLyrics = { onTabChange(FullPlayerTab.LYRICS) },
onVisibilityChange = { miniLyricsVisible = it },
modifier = Modifier.fillMaxWidth().padding(horizontal = 4.dp),
)
SeekBar(
progressState = progressState,
isPlaying = state.isPlaying,
Expand All @@ -2030,7 +2068,7 @@ internal fun FullPlayer(
)
Spacer(Modifier.height(12.dp))
MainControls(state, player, isTranslucent = LocalLiquidGlass.current || showFullBleed, design = nowPlayingDesign)
Spacer(Modifier.height(30.dp))
Spacer(Modifier.height(utilityControlsGap))
PlayerUtilityControls(
state = state,
player = player,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ internal fun FullPlayerLandscape(
state: MusicPlayerState,
player: MusicPlayer,
progressState: StateFlow<PlaybackProgressState>?,
lyricsState: LyricsUiState = LyricsUiState.Idle,
lyricsOffsetMs: Long = 0L,
nowPlayingMiniLyricsEnabled: Boolean = false,
seekbarStyle: SeekbarStyle = SeekbarStyle.DEFAULT,
nowPlayingDesign: com.lastwave.app.data.local.NowPlayingDesign = com.lastwave.app.data.local.NowPlayingDesign.CLASSIC,
wavySeekbarEnabled: Boolean = (seekbarStyle == SeekbarStyle.WAVY),
Expand Down Expand Up @@ -516,10 +519,26 @@ internal fun FullPlayerLandscape(
}
}

Spacer(Modifier.height(20.dp))
val resolvedProgressState = progressState ?: player.progressState
val miniLyricsCandidate = nowPlayingMiniLyricsEnabled &&
eligibleSyncedLines(lyricsState, lyricsTrackKey(track)) != null
Spacer(Modifier.height(if (miniLyricsCandidate) 8.dp else 20.dp))

NowPlayingMiniLyrics(
enabled = nowPlayingMiniLyricsEnabled,
trackKey = lyricsTrackKey(track),
lyricsState = lyricsState,
progressState = resolvedProgressState,
isPlaying = state.isPlaying,
lyricsOffsetMs = lyricsOffsetMs,
onOpenFullLyrics = { onTabChange(FullPlayerTab.LYRICS) },
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 4.dp),
)

SeekBar(
progressState = progressState ?: player.progressState,
progressState = resolvedProgressState,
isPlaying = state.isPlaying,
trackKey = track.videoId ?: "${track.artist}|${track.title}",
seekbarStyle = seekbarStyle,
Expand All @@ -545,11 +564,11 @@ internal fun FullPlayerLandscape(
onClick = onOpenSignalPath,
modifier = Modifier.offset(y = (-2).dp),
)
Spacer(Modifier.height(14.dp))
Spacer(Modifier.height(if (miniLyricsCandidate) 10.dp else 14.dp))

MainControls(state, player, isTranslucent = LocalLiquidGlass.current, design = nowPlayingDesign)

Spacer(Modifier.height(30.dp))
Spacer(Modifier.height(if (miniLyricsCandidate) 16.dp else 30.dp))

PlayerUtilityControls(
state = state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ sealed interface LyricsUiState {
val plainLyrics: String? = null,
val isInstrumental: Boolean = false,
val source: String? = null,
val trackKey: String? = null,
) : LyricsUiState {
val isRtl: Boolean get() = lines.any { it.isRtl } || isRtlText(plainLyrics)
}
Expand Down
Loading