Skip to content

Native Android client for Spotify, built with Jetpack Compose

The player can hide what some listeners find too much, each a switch in Settings → Display with today's look as the default: the lyrics preview card under the Classic player (a flick up on the cover still opens the lyrics), the source and quality line (under the title in Immersive, under the device in Classic; Sound quality then has a row in the player's menu next to Stats for nerds) and the capsule at the bottom of the Immersive player (the menu then has a Listen on row for the devices); shuffle and repeat in the capsule keep their own switch [skip ci]

kota-zo00d5fc1ebf48
diff --git a/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt b/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt
index 65562a80..bc8e5eb0 100644
--- a/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt
+++ b/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt
@@ -243,6 +243,53 @@ object LiquidGlassPref {
}
}
+/**
+ * "Lyrics preview in the player" (Settings > Display, Classic look): the lyrics card under the
+ * player. On by default; off, the lyrics still open with a flick up on the cover.
+ */
+object PlayerLyricsCardPref {
+ private const val KEY = "player_lyrics_card"
+ var on by androidx.compose.runtime.mutableStateOf(prefs(com.music.spotui.di.Graph.app).getBoolean(KEY, true))
+ private set
+
+ fun set(c: Context, value: Boolean) {
+ on = value
+ prefs(c).edit().putBoolean(KEY, value).apply()
+ }
+}
+
+/**
+ * "Source and quality in the player" (Settings > Display, both looks): the line that says what
+ * plays and how (under the title in the Immersive look, under the device in the Classic one). On
+ * by default; off, the player's menu has the Sound quality row (and Stats for nerds) instead.
+ */
+object PlayerSourceLinePref {
+ private const val KEY = "player_source_line"
+ var on by androidx.compose.runtime.mutableStateOf(prefs(com.music.spotui.di.Graph.app).getBoolean(KEY, true))
+ private set
+
+ fun set(c: Context, value: Boolean) {
+ on = value
+ prefs(c).edit().putBoolean(KEY, value).apply()
+ }
+}
+
+/**
+ * "Capsule in the player" (Settings > Display, Immersive look): the capsule at the bottom of the
+ * player (devices, with shuffle and repeat when [PlayerModesPref] is on). On by default; off, the
+ * player's menu has a Listen on row for the devices.
+ */
+object PlayerCapsulePref {
+ private const val KEY = "immersive_player_capsule"
+ var on by androidx.compose.runtime.mutableStateOf(prefs(com.music.spotui.di.Graph.app).getBoolean(KEY, true))
+ private set
+
+ fun set(c: Context, value: Boolean) {
+ on = value
+ prefs(c).edit().putBoolean(KEY, value).apply()
+ }
+}
+
/**
* "Shuffle and repeat in the player" (Settings > Display, Immersive look): on, the player's
* bottom capsule holds shuffle, repeat and devices (2.2); off, only devices, as in 2.1.0 (the
diff --git a/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt
index c334d4f0..659a14b1 100644
--- a/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt
@@ -112,10 +112,15 @@ fun SongOptionsSheet(
var showCredits by remember { mutableStateOf(false) }
var showSpeed by remember { mutableStateOf(false) }
var showNerd by remember { mutableStateOf(false) }
+ var showQuality by remember { mutableStateOf(false) }
if (showNerd) {
StatsForNerdsSheet(onDismiss = { showNerd = false; onDismiss() })
return
}
+ if (showQuality) {
+ QualitySheet(onDismiss = { showQuality = false; onDismiss() })
+ return
+ }
if (showCredits) {
CreditsSheet(song = song, onDismiss = { showCredits = false; onDismiss() })
return
@@ -341,6 +346,10 @@ fun SongOptionsSheet(
stringResource(R.string.context_menu_sleep_timer),
tint = if (active) MenuGreen else MenuIconColor,
) { showSleep = true }
+ // The source line of the player is turned off: its sheet is here instead.
+ if (!com.music.spotui.data.preferences.PlayerSourceLinePref.on) {
+ MenuRow(Icons.Outlined.GraphicEq, stringResource(R.string.quality_sheet_title)) { showQuality = true }
+ }
MenuRow(Icons.Outlined.Analytics, stringResource(R.string.nerd_title)) { showNerd = true }
}
// Entries from extensions (menu.items), after the app's own; each names its extension.
diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.kt
index 351cf786..9c1388ec 100644
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.kt
@@ -522,7 +522,21 @@ private fun DisplayPage(open: (SettingsPage) -> Unit, back: () -> Unit) {
ImmersiveSwitchRow(stringResource(R.string.settings_hide_dj_title), checked = com.music.spotui.data.preferences.HideDjPref.on,
onChecked = { com.music.spotui.data.preferences.HideDjPref.set(ctx, it) }, detail = stringResource(R.string.settings_hide_dj_detail))
}
+ if (look == com.music.spotui.data.preferences.Look.CLASSIC) {
+ row {
+ ImmersiveSwitchRow(stringResource(R.string.settings_player_lyrics_card_title), checked = com.music.spotui.data.preferences.PlayerLyricsCardPref.on,
+ onChecked = { com.music.spotui.data.preferences.PlayerLyricsCardPref.set(ctx, it) }, detail = stringResource(R.string.settings_player_lyrics_card_detail))
+ }
+ }
+ row {
+ ImmersiveSwitchRow(stringResource(R.string.settings_player_source_title), checked = com.music.spotui.data.preferences.PlayerSourceLinePref.on,
+ onChecked = { com.music.spotui.data.preferences.PlayerSourceLinePref.set(ctx, it) }, detail = stringResource(R.string.settings_player_source_detail))
+ }
if (look == com.music.spotui.data.preferences.Look.IMMERSIVE) {
+ row {
+ ImmersiveSwitchRow(stringResource(R.string.settings_player_capsule_title), checked = com.music.spotui.data.preferences.PlayerCapsulePref.on,
+ onChecked = { com.music.spotui.data.preferences.PlayerCapsulePref.set(ctx, it) }, detail = stringResource(R.string.settings_player_capsule_detail))
+ }
row {
ImmersiveSwitchRow(stringResource(R.string.settings_player_modes_title), checked = com.music.spotui.data.preferences.PlayerModesPref.on,
onChecked = { com.music.spotui.data.preferences.PlayerModesPref.set(ctx, it) }, detail = stringResource(R.string.settings_player_modes_detail))
diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.kt
index 78bf5f93..13188228 100644
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.kt
@@ -541,6 +541,7 @@ private fun RowScope.PlayerCredits(
// a moment after the song starts), so its arrival fades in below the title and artist
// instead of moving them.
val sourceLabel = com.music.spotui.ui.components.playingSourceLabel()
+ val sourceShown = com.music.spotui.data.preferences.PlayerSourceLinePref.on
val hasSource = sourceLabel.isNotBlank() && !state.adPlaying
val sourceAlpha by animateFloatAsState(if (hasSource) 1f else 0f, tween(250), label = "sourceLine")
val lineH = if (state.adPlaying) 24.sp else 22.sp
@@ -601,7 +602,7 @@ private fun RowScope.PlayerCredits(
}
// What the sound is when Myspoti's own player plays it (an extension's stream, a
// download); a tap opens what plays and its quality. Same state as the Classic player.
- if (!state.adPlaying) Text(
+ if (!state.adPlaying && sourceShown) Text(
text = sourceLabel.ifEmpty { " " },
style = Immersive.Caption.copy(lineHeight = 14.sp),
color = tint.copy(alpha = 0.45f),
diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt
index ae797cd3..390ef12e 100644
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt
@@ -478,6 +478,7 @@ internal fun PlayerActionRow(
onOpenDevices: () -> Unit,
) {
val modes = com.music.spotui.data.preferences.PlayerModesPref.on
+ val capsule = com.music.spotui.data.preferences.PlayerCapsulePref.on
BoxWithConstraints(Modifier.fillMaxWidth()) {
val widestRow = BOTTOM_ACTION_SIZE * 2 + pillWidth(if (modes) 3 else 2)
val edgeInset = ((maxWidth - widestRow) / 4).coerceAtLeast(0.dp)
@@ -509,8 +510,8 @@ internal fun PlayerActionRow(
)
}
// Laid out across the whole row and placed by hand: centred at 0, flush with the
- // lyrics glyph's left edge at 1.
- Box(
+ // lyrics glyph's left edge at 1. Not there at all with "Capsule in the player" off.
+ if (capsule) Box(
Modifier.layout { measurable, constraints ->
val placeable = measurable.measure(constraints.copy(minWidth = 0))
layout(constraints.maxWidth, placeable.height) {
diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.kt
index 1930ce4a..f05dabd5 100644
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.kt
@@ -20,6 +20,7 @@ import androidx.compose.material.icons.rounded.Block
import androidx.compose.material.icons.rounded.Bookmark
import androidx.compose.material.icons.rounded.Check
import androidx.compose.material.icons.rounded.DeleteOutline
+import androidx.compose.material.icons.rounded.Devices
import androidx.compose.material.icons.rounded.Info
import androidx.compose.material.icons.rounded.Lightbulb
import androidx.compose.material.icons.rounded.Translate
@@ -91,6 +92,10 @@ fun ImmersiveSongOptionsSheet(
var showMeaning by remember { mutableStateOf(false) }
var showSources by remember { mutableStateOf(false) }
var showNerd by remember { mutableStateOf(false) }
+ var showQuality by remember { mutableStateOf(false) }
+ var showDevices by remember { mutableStateOf(false) }
+ if (showQuality) { com.music.spotui.ui.components.QualitySheet(onDismiss = { showQuality = false; onDismiss() }); return }
+ if (showDevices) { com.music.spotui.ui.components.DevicesSheet(onDismiss = { showDevices = false; onDismiss() }); return }
if (showNerd) { com.music.spotui.ui.components.StatsForNerdsSheet(onDismiss = { showNerd = false; onDismiss() }); return }
if (showSources) { com.music.spotui.ui.components.LyricsSourceSheet(onDismiss = { showSources = false; onDismiss() }); return }
if (showCredits) { CreditsSheet(song = song, onDismiss = { showCredits = false; onDismiss() }); return }
@@ -321,6 +326,13 @@ fun ImmersiveSongOptionsSheet(
stringResource(R.string.context_menu_sleep_timer),
tint = if (SongPlayer.sleepEndsAt.value != null) LocalImmersiveSheetTint.current.accent else null,
) { showSleep = true }
+ // The player's source line and capsule are turned off: their sheets are here instead.
+ if (!com.music.spotui.data.preferences.PlayerSourceLinePref.on) {
+ ImmersiveSheetRow(Icons.Rounded.GraphicEq, stringResource(R.string.quality_sheet_title)) { showQuality = true }
+ }
+ if (!com.music.spotui.data.preferences.PlayerCapsulePref.on) {
+ ImmersiveSheetRow(Icons.Rounded.Devices, stringResource(R.string.listen_on)) { showDevices = true }
+ }
ImmersiveSheetRow(Icons.Rounded.Analytics, stringResource(R.string.nerd_title)) { showNerd = true }
}
// Entries from extensions (menu.items), after the app's own; each names its extension.
diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
index e2043f09..ba67445e 100644
--- a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
@@ -731,7 +731,7 @@ fun PlayerScreen(navController: NavController) {
// artwork only, so a swipe there cannot pull a card up under the compact strip.
if (!immersive) item {
// T4: no lyrics card during an ad break — the song it belongs to is not what plays.
- if (!audioBuffering && !adPlaying) InlineLyrics(
+ if (!audioBuffering && !adPlaying && com.music.spotui.data.preferences.PlayerLyricsCardPref.on) InlineLyrics(
title = songTitle,
artist = songSinger,
album = playerViewModel.currentSongAlbum.value,
@@ -1456,7 +1456,7 @@ fun PlayerConnectRow(
var nerd by remember { mutableStateOf(false) }
if (quality) com.music.spotui.ui.components.QualitySheet { quality = false }
if (nerd) com.music.spotui.ui.components.StatsForNerdsSheet { nerd = false }
- if (source.isNotBlank()) Text(
+ if (source.isNotBlank() && com.music.spotui.data.preferences.PlayerSourceLinePref.on) Text(
text = source,
color = com.music.spotui.ui.theme.AppMuted,
fontSize = 11.sp,
diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt
index ede22d50..0f5346d3 100644
--- a/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt
@@ -269,6 +269,18 @@ fun SettingsScreen(navController: NavController) {
checked = com.music.spotui.data.preferences.MusicVideoPref.on,
onChecked = { com.music.spotui.data.preferences.MusicVideoPref.set(ctx, it) },
)
+ OptionRow(
+ label = stringResource(R.string.settings_player_lyrics_card_title),
+ detail = stringResource(R.string.settings_player_lyrics_card_detail),
+ checked = com.music.spotui.data.preferences.PlayerLyricsCardPref.on,
+ onChecked = { com.music.spotui.data.preferences.PlayerLyricsCardPref.set(ctx, it) },
+ )
+ OptionRow(
+ label = stringResource(R.string.settings_player_source_title),
+ detail = stringResource(R.string.settings_player_source_detail),
+ checked = com.music.spotui.data.preferences.PlayerSourceLinePref.on,
+ onChecked = { com.music.spotui.data.preferences.PlayerSourceLinePref.set(ctx, it) },
+ )
OptionRow(
label = stringResource(R.string.settings_solid_nav_title),
detail = stringResource(R.string.settings_solid_nav_detail),
diff --git a/base/app/src/main/res/values/myspoti_strings.xml b/base/app/src/main/res/values/myspoti_strings.xml
index fef37e4e..2c2fce75 100644
--- a/base/app/src/main/res/values/myspoti_strings.xml
+++ b/base/app/src/main/res/values/myspoti_strings.xml
@@ -574,6 +574,12 @@
<string name="settings_hide_dj_detail">Removes Spotify\'s DJ from Home</string>
<string name="settings_player_modes_title">Shuffle and repeat in the player</string>
<string name="settings_player_modes_detail">Off, the player\'s capsule holds only the devices button, as in 2.1.0</string>
+ <string name="settings_player_lyrics_card_title">Lyrics preview in the player</string>
+ <string name="settings_player_lyrics_card_detail">The lyrics card under the player. Off, a flick up on the cover still opens the lyrics.</string>
+ <string name="settings_player_source_title">Source and quality in the player</string>
+ <string name="settings_player_source_detail">The line that says what plays and how. Off, Sound quality and Stats for nerds are in the player\'s menu.</string>
+ <string name="settings_player_capsule_title">Capsule in the player</string>
+ <string name="settings_player_capsule_detail">The buttons at the bottom of the player. Off, Listen on is in the player\'s menu.</string>
<string name="downloads_need_source">Downloads need a source extension. Install one in Settings, Extensions.</string>
<string name="downloads_source_row_title">Download source</string>
<string name="downloads_source_row_on">An extension gives the files. Tap to manage extensions.</string>