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.

Back from a page opened over the player, and pinned lists on top

Lelonio407203e969c6
diff --git a/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt b/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt
index 1ff8148..e36051c 100644
--- a/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt
+++ b/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt
@@ -1790,8 +1790,18 @@ fun SquareApp(
// this screen rather than under it.
val hasPreviousPage by viewModel.hasPreviousPage
.collectAsStateWithLifecycle()
+ // Not while the player is over the page. A page
+ // opened from the player, an artist from the song
+ // playing, registers its own answer to back after
+ // the player has registered the one that closes
+ // it, and the last one registered is the one the
+ // system asks: back closed the page underneath and
+ // left the player standing over nothing (#25).
+ val playerCovering by remember {
+ derivedStateOf { expand.value > 0.5f }
+ }
androidx.activity.compose.BackHandler(
- enabled = hasPreviousPage,
+ enabled = hasPreviousPage && !playerCovering,
) { viewModel.popPage() }
// One destination holds every detail page, so a
diff --git a/app/src/main/java/dev/lelonio/square/ui/library/LibraryScreen.kt b/app/src/main/java/dev/lelonio/square/ui/library/LibraryScreen.kt
index 890a872..df65972 100644
--- a/app/src/main/java/dev/lelonio/square/ui/library/LibraryScreen.kt
+++ b/app/src/main/java/dev/lelonio/square/ui/library/LibraryScreen.kt
@@ -256,14 +256,17 @@ fun LibraryScreen(
// reversing "recently opened" is "least recently", and a
// separate control for that would be a second sort.
.let { if (descending) it.reversed() else it }
- // Pinning outranks the sort: it is the one instruction the
- // listener gave about this list themselves.
- .withPinnedFirst(pinned)
- // And the phone's own music outranks that, because it is
- // not a playlist competing for a place: it is a fixed shelf
- // of the library, and one nobody has opened yet would
- // otherwise sit sixtieth among lists they have.
+ // The phone's own music and what is kept on it outrank
+ // the sort: they are not playlists competing for a place
+ // but fixed shelves of the library, and one nobody has
+ // opened yet would otherwise sit sixtieth among lists.
.withLocalFilesFirst()
+ // And pinning outranks even those: it is the one
+ // instruction the listener gave about this list
+ // themselves, and a shelf they never asked for standing
+ // above the lists they chose to keep at the top is the app
+ // overruling them (#25).
+ .withPinnedFirst(pinned)
// Once more at the end, because every row below is keyed
// on its address and a list that holds one twice does not
// draw, it crashes. Spotify can hand the same playlist back