Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.
Kotlin alternativeandroidandroid-applicationclientglassmorphisminnertubelibrespotliquid-glassspotifyspotify-connectspotifyapiyoutube-musicyoutube-playerytdlnis
Switch the player's views with the segmented control
Lelonio9994b3140754
diff --git a/.claude/settings.local.json b/.claude/settings.local.jsonindex 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.binindex 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 Logljh/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/additional_project_files.txtCA-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint �����3 ����3i+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint �����3 ����3ig-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� ����3nl-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 �����3db-`/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 @ ����3ec-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�� ����3ig-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 �" ����3om-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 ( ����3ge-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 ����3DB-@/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 filediff --git a/app/src/main/java/dev/emanuele/spot/ui/player/PlayerPanel.kt b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerPanel.ktindex 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.RoundedCornerShapeimport androidx.compose.foundation.verticalScrollimport androidx.compose.material.icons.Iconsimport androidx.compose.material.icons.filled.Add-import androidx.compose.material.icons.automirrored.filled.QueueMusic+import androidx.compose.material.icons.filled.Albumimport androidx.compose.material.icons.filled.Closeimport androidx.compose.material.icons.filled.Lyricsimport androidx.compose.material.icons.filled.Tune@@ -35,6 +35,7 @@ import androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.remember+import androidx.compose.runtime.rememberUpdatedStateimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier@@ -44,6 +45,9 @@ import androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dpimport dev.emanuele.spot.data.Lyricsimport dev.emanuele.spot.playback.EffectPreset+import androidx.compose.foundation.layout.RowScope+import dev.emanuele.spot.ui.glass.LiquidBottomTab+import dev.emanuele.spot.ui.glass.LiquidBottomTabsimport dev.emanuele.spot.ui.glass.LiquidSliderimport kotlin.math.lnimport 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.ktindex 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.KeyboardArrowDownimport androidx.compose.material.icons.filled.MoreHorizimport androidx.compose.material.icons.filled.Pauseimport androidx.compose.material.icons.filled.PlayArrow-import androidx.compose.material.icons.filled.QueueMusic+import androidx.compose.material.icons.automirrored.filled.QueueMusicimport androidx.compose.material.icons.filled.Repeatimport androidx.compose.material.icons.filled.RepeatOneimport 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,