Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Switch the player's views with the segmented control

Lelonio9994b3140754
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index 3fa1f74..ff71af1 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -93,7 +93,8 @@
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Let the page show through the player as it is dragged away *)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Contract the player as it collapses *)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Make closing the player the opening reversed *)",
- "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Player controls: one queue button, a working heart, icon tabs *)"
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Player controls: one queue button, a working heart, icon tabs *)",
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Switch the player'\\\\''s views with the segmented control *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index 2089b7d..40dd0ba 100644
--- a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logl
j
h/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ����3i
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �����3� ����3n
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �����3� ����3n
l
-j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �����3� �����3[
+j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �����3� �����3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �����3�� ����3_
+W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �����3�� ����3_
]
-[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �����3d
+[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �����3d
b
-`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �����3 @ ����3e
+`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �����3 @ ����3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �����3�� ����3i
+a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �����3�� ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �����3 �" ����3o
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �����3 �" ����3o
m
-k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �����3
+k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �����3
� ����3b
`
-^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �����3  ( ����3g
+^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �����3  ( ����3g
e
-c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �����3  b ����3D
+c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �����3  b ����3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/src/main/java/dev/emanuele/spot/ui/player/PlayerPanel.kt b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerPanel.kt
index 29ac6a8..23035f7 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/PlayerPanel.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerPanel.kt
@@ -20,7 +20,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
-import androidx.compose.material.icons.automirrored.filled.QueueMusic
+import androidx.compose.material.icons.filled.Album
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Lyrics
import androidx.compose.material.icons.filled.Tune
@@ -35,6 +35,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -44,6 +45,9 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import dev.emanuele.spot.data.Lyrics
import dev.emanuele.spot.playback.EffectPreset
+import androidx.compose.foundation.layout.RowScope
+import dev.emanuele.spot.ui.glass.LiquidBottomTab
+import dev.emanuele.spot.ui.glass.LiquidBottomTabs
import dev.emanuele.spot.ui.glass.LiquidSlider
import kotlin.math.ln
import kotlin.math.roundToInt
@@ -75,26 +79,38 @@ fun PlayerPanelSection(
backdrop: com.kyant.backdrop.Backdrop,
) {
Column(Modifier.fillMaxWidth()) {
- Row(
- Modifier
+ // The same segmented control the tab bar uses, because this is the same
+ // kind of choice: three views of one screen, exactly one of them
+ // showing. Three separate toggles said "three independent switches",
+ // which is not what cover, lyrics and effects are.
+ //
+ // The queue is deliberately not in here — it is a sheet that opens over
+ // the player rather than a view of it, and it has its own button beside
+ // the title.
+ val views = remember { listOf(PlayerPanel.NONE, PlayerPanel.LYRICS, PlayerPanel.EFFECTS) }
+ val selected = views.indexOf(panel).coerceAtLeast(0)
+ // Stable, or LiquidBottomTabs throws away the state it keys on this and
+ // the indicator stops animating; see the note in SpotApp.
+ val selectedState = rememberUpdatedState(selected)
+ val selectedTabIndex = remember { { selectedState.value } }
+
+ LiquidBottomTabs(
+ selectedTabIndex = selectedTabIndex,
+ onTabSelected = { onSelect(views[it]) },
+ backdrop = backdrop,
+ tabsCount = views.size,
+ accentColor = GlassInk,
+ containerColor = GlassFilm,
+ modifier = Modifier
.fillMaxWidth()
- .padding(top = 18.dp),
- horizontalArrangement = Arrangement.Center,
+ .padding(top = 16.dp),
) {
- PanelTab(
- Icons.AutoMirrored.Filled.QueueMusic,
- "Coda",
- panel == PlayerPanel.QUEUE,
- ) {
- onSelect(if (panel == PlayerPanel.QUEUE) PlayerPanel.NONE else PlayerPanel.QUEUE)
- }
- PanelTab(Icons.Filled.Lyrics, "Testo", panel == PlayerPanel.LYRICS) {
- onSelect(if (panel == PlayerPanel.LYRICS) PlayerPanel.NONE else PlayerPanel.LYRICS)
+ PanelTab(Icons.Filled.Album, "Copertina", selected == 0) { onSelect(PlayerPanel.NONE) }
+ PanelTab(Icons.Filled.Lyrics, "Testo", selected == 1) {
+ onSelect(PlayerPanel.LYRICS)
}
- PanelTab(Icons.Filled.Tune, "Effetti", panel == PlayerPanel.EFFECTS) {
- onSelect(
- if (panel == PlayerPanel.EFFECTS) PlayerPanel.NONE else PlayerPanel.EFFECTS,
- )
+ PanelTab(Icons.Filled.Tune, "Effetti", selected == 2) {
+ onSelect(PlayerPanel.EFFECTS)
}
}
@@ -146,22 +162,25 @@ fun PlayerPanelSection(
* content description, which is what a screen reader wants anyway.
*/
@Composable
-private fun PanelTab(
+private fun RowScope.PanelTab(
icon: androidx.compose.ui.graphics.vector.ImageVector,
label: String,
selected: Boolean,
onClick: () -> Unit,
) {
- Icon(
- imageVector = icon,
- contentDescription = label,
- tint = if (selected) GlassInk else GlassInkDim,
- modifier = Modifier
- .clip(RoundedCornerShape(50))
- .clickable(onClick = onClick)
- .padding(horizontal = 20.dp, vertical = 8.dp)
- .size(22.dp),
- )
+ LiquidBottomTab(onClick = onClick) {
+ Icon(
+ imageVector = icon,
+ contentDescription = label,
+ tint = if (selected) GlassInk else GlassInkDim,
+ modifier = Modifier.size(21.dp),
+ )
+ Text(
+ label,
+ style = MaterialTheme.typography.bodySmall,
+ color = if (selected) GlassInk else GlassInkDim,
+ )
+ }
}
/** One row of the upcoming-tracks list. */
diff --git a/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt
index 503aa92..8cdd896 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt
@@ -37,7 +37,7 @@ import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.MoreHoriz
import androidx.compose.material.icons.filled.Pause
import androidx.compose.material.icons.filled.PlayArrow
-import androidx.compose.material.icons.filled.QueueMusic
+import androidx.compose.material.icons.automirrored.filled.QueueMusic
import androidx.compose.material.icons.filled.Repeat
import androidx.compose.material.icons.filled.RepeatOne
import androidx.compose.material.icons.filled.Shuffle
@@ -318,11 +318,33 @@ fun PlayerScreen(
verticalAlignment = Alignment.CenterVertically,
) {
TitleBlock(state, Modifier.weight(1f))
- // The queue used to have a button here as well
- // as one in the top bar and its own tab below —
- // three controls for one panel. The tab is the
- // one that stayed: it is where the other panels
- // are.
+ // The queue's one control. It is a sheet that
+ // opens over the player rather than a view of
+ // it, which is why it sits here and not in the
+ // segmented switch below.
+ RoundGlassButton(
+ backdrop = glassBackdrop,
+ size = 40.dp,
+ onClick = {
+ panel = if (panel == PlayerPanel.QUEUE) {
+ PlayerPanel.NONE
+ } else {
+ PlayerPanel.QUEUE
+ }
+ },
+ ) {
+ Icon(
+ Icons.AutoMirrored.Filled.QueueMusic,
+ contentDescription = "Coda",
+ tint = if (panel == PlayerPanel.QUEUE) {
+ MaterialTheme.colorScheme.primary
+ } else {
+ GlassInk
+ },
+ modifier = Modifier.size(20.dp),
+ )
+ }
+ Spacer(Modifier.size(8.dp))
RoundGlassButton(
backdrop = glassBackdrop,
size = 40.dp,