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.

One panel for everything the player shows, dimmed alike

Lelonio0769e6f24650
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index 37de6e1..448df54 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -126,7 +126,8 @@
"Bash(git commit -q -m 'Deliver the notification intent; blur what the sheets actually cover *)",
"Bash(git commit -q -m 'An icon made of the app'\\\\''s own glass *)",
"Bash(git commit -q -m 'Hold the cover until the Canvas has a frame *)",
- "Bash(git commit -q -m 'Darken the Canvas while paused *)"
+ "Bash(git commit -q -m 'Darken the Canvas while paused *)",
+ "Bash(git commit -q -m 'One panel for everything the player shows, dimmed alike *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index e5a86b0..6b6f11a 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/MainViewModel.kt b/app/src/main/java/dev/emanuele/spot/ui/MainViewModel.kt
index 590256d..488da76 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/MainViewModel.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/MainViewModel.kt
@@ -277,9 +277,13 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {
private val _addToPlaylist = MutableStateFlow(AddToPlaylistState())
val addToPlaylist: StateFlow<AddToPlaylistState> = _addToPlaylist.asStateFlow()
- fun openAddToPlaylist(trackUri: String?, trackTitle: String) {
+ /**
+ * @param asSheet whether to show the modal. False from the player, which
+ * shows the same picker in its own panel and would otherwise get both.
+ */
+ fun openAddToPlaylist(trackUri: String?, trackTitle: String, asSheet: Boolean = true) {
_addToPlaylist.value = AddToPlaylistState(
- open = true,
+ open = asSheet,
trackUri = trackUri,
trackTitle = trackTitle,
playlists = (_state.value as? UiState.Ready)?.playlists.orEmpty(),
diff --git a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
index 7e8da28..d113da1 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
@@ -543,8 +543,14 @@ fun SpotApp(
onRefreshDevices = viewModel::refreshDevices,
onSelectDevice = { viewModel.transferPlayback(it) },
onAddToPlaylist = {
- viewModel.openAddToPlaylist(playback.mediaId, playback.title)
+ viewModel.openAddToPlaylist(
+ playback.mediaId,
+ playback.title,
+ asSheet = false,
+ )
},
+ addToPlaylist = addToPlaylist,
+ onPickPlaylist = viewModel::addToPlaylist,
)
},
)
diff --git a/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt b/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt
index 6f36e37..ff736b6 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt
@@ -173,6 +173,81 @@ fun AddToPlaylistSheet(
}
}
+/**
+ * The picker itself, without a sheet around it.
+ *
+ * The player puts this in the panel that shows the lyrics and the queue instead
+ * of opening a modal over the transport; everywhere else still gets the sheet.
+ */
+@Composable
+fun PlaylistPicker(
+ state: MainViewModel.AddToPlaylistState,
+ onSelect: (CatalogPlaylist) -> Unit,
+) {
+ Column(Modifier.padding(vertical = 18.dp)) {
+ Text(
+ "Aggiungi a una playlist",
+ style = MaterialTheme.typography.titleLarge,
+ color = GlassInk,
+ modifier = Modifier.padding(start = 22.dp, end = 22.dp),
+ )
+ Text(
+ // Says what is being added: the sheet can outlive the track
+ // that opened it, since playback carries on underneath.
+ state.trackTitle,
+ style = MaterialTheme.typography.bodyMedium,
+ color = GlassInkDim,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(start = 22.dp, end = 22.dp, top = 2.dp, bottom = 12.dp),
+ )
+
+ if (state.error != null) {
+ Text(
+ state.error,
+ style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.error,
+ modifier = Modifier.padding(horizontal = 22.dp, vertical = 8.dp),
+ )
+ }
+
+ if (state.done != null) {
+ Text(
+ "Aggiunto a ${state.done}",
+ style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.primary,
+ modifier = Modifier.padding(horizontal = 22.dp, vertical = 8.dp),
+ )
+ }
+
+ if (state.playlists.isEmpty()) {
+ Text(
+ "Nessuna playlist nel tuo account",
+ style = MaterialTheme.typography.bodyMedium,
+ color = GlassInkDim,
+ modifier = Modifier.padding(horizontal = 22.dp, vertical = 12.dp),
+ )
+ } else {
+ Column(
+ Modifier
+ .heightIn(max = 360.dp)
+ .verticalScroll(rememberScrollState()),
+ verticalArrangement = Arrangement.spacedBy(2.dp),
+ ) {
+ state.playlists.forEach { playlist ->
+ PlaylistRow(
+ playlist = playlist,
+ busy = state.busy == playlist.uri,
+ added = state.done == playlist.name,
+ enabled = state.trackUri != null && state.busy == null,
+ onClick = { onSelect(playlist) },
+ )
+ }
+ }
+ }
+ }
+}
+
@Composable
private fun PlaylistRow(
playlist: CatalogPlaylist,
diff --git a/app/src/main/java/dev/emanuele/spot/ui/player/DevicePicker.kt b/app/src/main/java/dev/emanuele/spot/ui/player/DevicePicker.kt
index c28c88a..e468b16 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/DevicePicker.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/DevicePicker.kt
@@ -145,6 +145,86 @@ fun DevicePicker(
}
}
+/**
+ * The list itself, without a sheet around it.
+ *
+ * The player shows this in the panel it uses for the lyrics and the queue rather
+ * than as a modal over the transport; the modal form is still what the rest of
+ * the app gets.
+ */
+@Composable
+fun DeviceList(
+ state: MainViewModel.DevicesState,
+ onSelect: (String) -> Unit,
+ onRefresh: () -> Unit,
+) {
+ Column(Modifier.padding(vertical = 18.dp)) {
+ Row(
+ Modifier
+ .fillMaxWidth()
+ .padding(start = 22.dp, end = 14.dp, bottom = 10.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Text(
+ "Riproduci su",
+ style = MaterialTheme.typography.titleLarge,
+ color = GlassInk,
+ modifier = Modifier.weight(1f),
+ )
+ Box(
+ Modifier
+ .size(36.dp)
+ .clip(RoundedCornerShape(50))
+ .clickable(onClick = onRefresh),
+ contentAlignment = Alignment.Center,
+ ) {
+ Icon(
+ PhosphorIcons.Regular.ArrowClockwise,
+ contentDescription = "Aggiorna",
+ tint = GlassInkDim,
+ modifier = Modifier.size(20.dp),
+ )
+ }
+ }
+
+ when {
+ state.loading && state.devices.isEmpty() -> Box(
+ Modifier
+ .fillMaxWidth()
+ .padding(vertical = 26.dp),
+ contentAlignment = Alignment.Center,
+ ) {
+ CircularProgressIndicator(color = GlassInkDim, strokeWidth = 2.dp)
+ }
+
+ state.error != null -> Text(
+ state.error,
+ style = MaterialTheme.typography.bodyMedium,
+ color = GlassInkDim,
+ modifier = Modifier.padding(horizontal = 22.dp, vertical = 12.dp),
+ )
+
+ state.devices.isEmpty() -> Text(
+ "Nessun dispositivo disponibile",
+ style = MaterialTheme.typography.bodyMedium,
+ color = GlassInkDim,
+ modifier = Modifier.padding(horizontal = 22.dp, vertical = 12.dp),
+ )
+
+ else -> Column(
+ Modifier
+ .heightIn(max = 320.dp)
+ .verticalScroll(rememberScrollState()),
+ verticalArrangement = Arrangement.spacedBy(2.dp),
+ ) {
+ state.devices.forEach { device ->
+ DeviceRow(device) { onSelect(device.id) }
+ }
+ }
+ }
+ }
+}
+
@Composable
private fun DeviceRow(device: MainViewModel.SpotifyDevice, onClick: () -> Unit) {
Row(
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 ce8ea52..16a8127 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
@@ -54,7 +54,23 @@ import com.adamglin.phosphoricons.regular.VinylRecord
import com.adamglin.phosphoricons.regular.X
/** Which panel is open below the transport controls. */
-enum class PlayerPanel { NONE, QUEUE, LYRICS, EFFECTS }
+enum class PlayerPanel {
+ NONE,
+ QUEUE,
+ LYRICS,
+ EFFECTS,
+
+ /**
+ * The Connect device list and the playlist picker.
+ *
+ * Both used to open as modals over the transport. The player already has one
+ * place where a second thing is shown — the slot the cover lives in — and
+ * two mechanisms for the same job meant the screen sometimes dimmed itself
+ * and sometimes did not, depending on which button had been pressed.
+ */
+ DEVICES,
+ ADD_TO_PLAYLIST,
+}
@Composable
fun PlayerPanelSection(
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 28d1ce5..9cdaf90 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
@@ -16,6 +16,8 @@ import androidx.compose.animation.core.spring
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@@ -113,7 +115,7 @@ private const val PAUSED_DIM = 0.55f
* back here as a full-bleed backdrop.
*/
/** What occupies the middle of the player. */
-private enum class Stage { COVER, LYRICS, EFFECTS, QUEUE, CANVAS }
+private enum class Stage { COVER, LYRICS, EFFECTS, QUEUE, DEVICES, ADD_TO_PLAYLIST, CANVAS }
@UnstableApi
@Composable
@@ -165,6 +167,9 @@ fun PlayerScreen(
* of one thing.
*/
onAddToPlaylist: () -> Unit,
+ /** The playlist picker's state, shown in the panel rather than as a sheet. */
+ addToPlaylist: MainViewModel.AddToPlaylistState,
+ onPickPlaylist: (dev.emanuele.spot.data.CatalogPlaylist) -> Unit,
) {
var panel by remember { mutableStateOf(PlayerPanel.NONE) }
@@ -290,8 +295,12 @@ fun PlayerScreen(
// read as the video having stalled rather than as playback having
// stopped. Dimming it says the same thing the picture cannot.
if (canvas != null) {
- val pausedDim by animateFloatAsState(
- targetValue = if (state.isPlaying) 0f else 1f,
+ // Darkened for a paused track and for an open panel alike. Both
+ // are the same statement — the clip is not what you are looking
+ // at right now — and the blur alone left a bright moving picture
+ // behind a column of text.
+ val dim by animateFloatAsState(
+ targetValue = if (state.isPlaying && !panelOpen) 0f else 1f,
animationSpec = tween(420),
label = "canvasDim",
)
@@ -309,7 +318,7 @@ fun PlayerScreen(
)
.drawWithContent {
drawContent()
- drawRect(Color.Black, alpha = pausedDim * PAUSED_DIM)
+ drawRect(Color.Black, alpha = dim * PAUSED_DIM)
},
)
}
@@ -327,7 +336,14 @@ fun PlayerScreen(
backdrop = glassBackdrop,
panel = panel,
onCollapse = onCollapse,
- onOpenDevices = onOpenDevices,
+ onOpenDevices = {
+ panel = if (panel == PlayerPanel.DEVICES) {
+ PlayerPanel.NONE
+ } else {
+ onOpenDevices()
+ PlayerPanel.DEVICES
+ }
+ },
)
// Everything sits at the bottom, as in the reference: the
@@ -367,6 +383,8 @@ fun PlayerScreen(
PlayerPanel.LYRICS -> Stage.LYRICS
PlayerPanel.EFFECTS -> Stage.EFFECTS
PlayerPanel.QUEUE -> Stage.QUEUE
+ PlayerPanel.DEVICES -> Stage.DEVICES
+ PlayerPanel.ADD_TO_PLAYLIST -> Stage.ADD_TO_PLAYLIST
PlayerPanel.NONE ->
if (canvas == null || !canvasReady) {
Stage.COVER
@@ -429,6 +447,29 @@ fun PlayerScreen(
QueueList(queue, onPlayQueueItem)
}
+ Stage.DEVICES -> Box(
+ Modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState()),
+ ) {
+ DeviceList(
+ state = devices,
+ onSelect = onSelectDevice,
+ onRefresh = onRefreshDevices,
+ )
+ }
+
+ Stage.ADD_TO_PLAYLIST -> Box(
+ Modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState()),
+ ) {
+ PlaylistPicker(
+ state = addToPlaylist,
+ onSelect = onPickPlaylist,
+ )
+ }
+
// The clip is the picture, and it is drawn
// behind everything: this slot only has to keep
// the space.
@@ -499,7 +540,14 @@ fun PlayerScreen(
RoundGlassButton(
backdrop = glassBackdrop,
size = 40.dp,
- onClick = onAddToPlaylist,
+ onClick = {
+ panel = if (panel == PlayerPanel.ADD_TO_PLAYLIST) {
+ PlayerPanel.NONE
+ } else {
+ onAddToPlaylist()
+ PlayerPanel.ADD_TO_PLAYLIST
+ }
+ },
) {
Icon(
PhosphorIcons.Regular.Plus,
@@ -564,18 +612,6 @@ fun PlayerScreen(
}
}
- // Over everything, including the transport: it is a modal choice, and
- // the controls underneath would be operating a device the user is in
- // the middle of changing.
- if (devices.open) {
- DevicePicker(
- state = devices,
- backdrop = glassBackdrop,
- onSelect = onSelectDevice,
- onRefresh = onRefreshDevices,
- onDismiss = onCloseDevices,
- )
- }
}
}
@@ -602,6 +638,8 @@ private fun TopBar(
PlayerPanel.LYRICS -> "Testo"
PlayerPanel.EFFECTS -> "Effetti"
PlayerPanel.QUEUE -> "In coda"
+ PlayerPanel.DEVICES -> "Riproduci su"
+ PlayerPanel.ADD_TO_PLAYLIST -> "Aggiungi a una playlist"
PlayerPanel.NONE -> "In riproduzione"
},
animationSpec = tween(220),