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
Tabs that share nothing, lists like this one, and glass the colour of the record
Lelonio9d6f7d33337a
diff --git a/app/src/main/java/dev/lelonio/square/data/ArtistPlaylists.kt b/app/src/main/java/dev/lelonio/square/data/ArtistPlaylists.ktnew file mode 100644index 0000000..3f277ad--- /dev/null+++ b/app/src/main/java/dev/lelonio/square/data/ArtistPlaylists.kt@@ -0,0 +1,55 @@+package dev.lelonio.square.data++import org.json.JSONObject++/**+ * The playlists an artist is in, read from Spotify's own gateway.+ *+ * The row the desktop client heads "Featuring" on an artist's page, and the+ * one place "This Is" can be found without guessing: it comes first, Spotify's+ * own, followed by the artist's radio and the editorial lists they are on. The+ * Web API has no endpoint for it, and searching for "This Is" plus a name+ * finds everything anybody ever titled after them.+ *+ * Forgiving in the same way [PlaylistContents] is, and for the same reason.+ */+object ArtistPlaylists {++ /** Null when the answer was not an artist's page: a retired query hash, a 401. */+ fun parse(json: String): List<SearchItem>? = runCatching {+ val items = JSONObject(json)+ .getJSONObject("data")+ .getJSONObject("artistUnion")+ .getJSONObject("relatedContent")+ .getJSONObject("featuringV2")+ .getJSONArray("items")++ (0 until items.length()).mapNotNull { index ->+ val data = items.optJSONObject(index)?.optJSONObject("data") ?: return@mapNotNull null+ // The row mixes in what it could not resolve as "GenericError".+ if (data.optString("__typename") != "Playlist") return@mapNotNull null+ val uri = data.optString("uri").takeIf { it.startsWith("spotify:playlist:") }+ ?: return@mapNotNull null+ val name = data.optString("name").takeIf { it.isNotBlank() } ?: return@mapNotNull null+ SearchItem(+ uri = uri,+ title = name,+ subtitle = plain(data.optString("description")),+ artworkUrl = data.optJSONObject("images")+ ?.optJSONArray("items")?.optJSONObject(0)+ ?.optJSONArray("sources")?.optJSONObject(0)+ ?.optString("url")?.takeIf { it.isNotEmpty() },+ )+ }+ // "This Is" first when the row did not already put it there: it is+ // the one everybody means by "the artist's playlist".+ .sortedBy { if (it.uri.startsWith(THIS_IS) || it.title.startsWith("This Is")) 0 else 1 }+ }.getOrNull()++ /** Descriptions can carry markup, links to an Instagram account for one. */+ private fun plain(text: String): String =+ android.text.Html.fromHtml(text, android.text.Html.FROM_HTML_MODE_LEGACY).toString().trim()++ /** Every "This Is" playlist so far has lived under this prefix. */+ private const val THIS_IS = "spotify:playlist:37i9dQZF1DZ06"+}diff --git a/app/src/main/java/dev/lelonio/square/data/Gateway.kt b/app/src/main/java/dev/lelonio/square/data/Gateway.ktindex a30c652..0cfcd63 100644--- a/app/src/main/java/dev/lelonio/square/data/Gateway.kt+++ b/app/src/main/java/dev/lelonio/square/data/Gateway.kt@@ -31,6 +31,53 @@ class Gateway(private val keys: PathfinderKeys) {),)+ /**+ * The playlists an artist is in, "This Is" first; see [ArtistPlaylists].+ *+ * Null when the gateway will not answer, which leaves the caller its own+ * way in.+ */+ suspend fun artistPlaylists(artistUri: String): List<SearchItem>? {+ keys.refresh()+ // The web player's own variables. Its locale is a path segment, which+ // English does without.+ val language = java.util.Locale.getDefault().language+ val locale = if (language == "en") "" else "intl-$language"+ return runCatching {+ ArtistPlaylists.parse(+ query(+ operation = "queryArtistOverview",+ hash = keys.artistOverview,+ variables = """{"uri":"$artistUri","locale":"$locale","preReleaseV2":true}""",+ ),+ )+ }+ .onFailure { android.util.Log.i(TAG, "artist playlists unavailable: ${it.message}") }+ .getOrNull()+ }++ /**+ * The playlists like this one, for the row under it; see [RelatedPlaylists].+ *+ * Null when the gateway will not answer, and the row is then simply not+ * there.+ */+ suspend fun relatedPlaylists(playlistUri: String): List<SearchItem>? {+ keys.refresh()+ return runCatching {+ RelatedPlaylists.parse(+ query(+ operation = "playlistSection",+ hash = keys.playlistSection,+ variables = """{"sectionUri":"${RelatedPlaylists.SECTION}",""" ++ """"playlistUri":"$playlistUri"}""",+ ),+ )+ }+ .onFailure { android.util.Log.i(TAG, "related playlists unavailable: ${it.message}") }+ .getOrNull()+ }+/** One page of a playlist; see [PlaylistContents]. */suspend fun playlistTracks(uri: String, offset: Int): GatewayPage? = PlaylistContents.parse(query(diff --git a/app/src/main/java/dev/lelonio/square/data/PathfinderKeys.kt b/app/src/main/java/dev/lelonio/square/data/PathfinderKeys.ktindex 706c47e..1ecede8 100644--- a/app/src/main/java/dev/lelonio/square/data/PathfinderKeys.kt+++ b/app/src/main/java/dev/lelonio/square/data/PathfinderKeys.kt@@ -49,10 +49,18 @@ class PathfinderKeys(context: Context) {/** And for `browsePage`, which is a whole page of Spotify's own browse. */val browsePage: String get() = prefs.getString(KEY_BROWSE_PAGE, null) ?: DEFAULT_BROWSE_PAGE+ /** And `queryArtistOverview`, which is an artist's page; see ArtistPlaylists. */+ val artistOverview: String+ get() = prefs.getString(KEY_ARTIST_OVERVIEW, null) ?: DEFAULT_ARTIST_OVERVIEW+/** And `browseSection`, for reading one of that page's rows past its first few. */val browseSection: Stringget() = prefs.getString(KEY_BROWSE_SECTION, null) ?: DEFAULT_BROWSE_SECTION+ /** And `playlistSection`, the row under a playlist; see RelatedPlaylists. */+ val playlistSection: String+ get() = prefs.getString(KEY_PLAYLIST_SECTION, null) ?: DEFAULT_PLAYLIST_SECTION+/** The web client version the gateway is told about. */val appVersion: String get() = prefs.getString(KEY_VERSION, null) ?: DEFAULT_VERSION@@ -87,6 +95,10 @@ class PathfinderKeys(context: Context) {?.let { edit.putString(KEY_BROWSE_PAGE, it) }body.optString("browseSection").takeIf { it.length == HASH_LENGTH }?.let { edit.putString(KEY_BROWSE_SECTION, it) }+ body.optString("artistOverview").takeIf { it.length == HASH_LENGTH }+ ?.let { edit.putString(KEY_ARTIST_OVERVIEW, it) }+ body.optString("playlistSection").takeIf { it.length == HASH_LENGTH }+ ?.let { edit.putString(KEY_PLAYLIST_SECTION, it) }body.optString("appVersion").takeIf { it.isNotEmpty() }?.let { edit.putString(KEY_VERSION, it) }edit.apply()@@ -104,6 +116,8 @@ class PathfinderKeys(context: Context) {const val KEY_SEARCH = "search"const val KEY_BROWSE_PAGE = "browse_page"const val KEY_BROWSE_SECTION = "browse_section"+ const val KEY_ARTIST_OVERVIEW = "artist_overview"+ const val KEY_PLAYLIST_SECTION = "playlist_section"const val KEY_VERSION = "app_version"const val KEY_CHECKED = "checked_at"@@ -132,6 +146,10 @@ class PathfinderKeys(context: Context) {"f5c4e6d668f5716464a231c1cc8b22c1cbf6ad68b09929fd7de813a30581298b"const val DEFAULT_BROWSE_SECTION ="b13c1cccbfcb6947753c2613411b3566485c21fd5f36d80a80bb64be61ba2d51"+ const val DEFAULT_ARTIST_OVERVIEW =+ "9f8134ef565e78621f1e1793555bd6633c5ac144ae0f89604ed3ae3f80b3c8e6"+ const val DEFAULT_PLAYLIST_SECTION =+ "2615df403a9043c1d7d3094fbeb4c9653b07b11a33d8081fbd31f0f7959ff4a1"const val DEFAULT_VERSION = "1.2.97.155.g5dd0dcaf-development"}}diff --git a/app/src/main/java/dev/lelonio/square/data/RelatedPlaylists.kt b/app/src/main/java/dev/lelonio/square/data/RelatedPlaylists.ktnew file mode 100644index 0000000..16e675d--- /dev/null+++ b/app/src/main/java/dev/lelonio/square/data/RelatedPlaylists.kt@@ -0,0 +1,66 @@+package dev.lelonio.square.data++import org.json.JSONObject++/**+ * The playlists shown under a playlist, read from Spotify's own gateway.+ *+ * The row the web player draws once the last song has scrolled past: lists+ * like the one on screen, picked by Spotify for that list. The Web API has no+ * endpoint for it. The answer comes back in the home page's shape, a+ * collection of sections with one row in it, and carries no heading of its+ * own; the page supplies that.+ *+ * Forgiving in the same way [PlaylistContents] is, and for the same reason.+ */+object RelatedPlaylists {++ /**+ * The row to ask for, alongside the playlist it is about.+ *+ * The same section for every list the web player was seen asking about,+ * a Daily Mix among them, the way the home page's recents are one fixed+ * section too.+ */+ const val SECTION = "spotify:section:0JQ5DAob0LgAOAm50K90Od"++ /** Null when the answer was not that row: a retired query hash, a 401. */+ fun parse(json: String): List<SearchItem>? = runCatching {+ val sections = JSONObject(json)+ .getJSONObject("data")+ .getJSONObject("homeSections")+ .getJSONArray("sections")++ (0 until sections.length()).flatMap { section ->+ val items = sections.optJSONObject(section)+ ?.optJSONObject("sectionItems")+ ?.optJSONArray("items")+ ?: return@flatMap emptyList()+ (0 until items.length()).mapNotNull { index ->+ val data = items.optJSONObject(index)+ ?.optJSONObject("content")+ ?.optJSONObject("data")+ ?: return@mapNotNull null+ if (data.optString("__typename") != "Playlist") return@mapNotNull null+ val uri = data.optString("uri").takeIf { it.startsWith("spotify:playlist:") }+ ?: return@mapNotNull null+ val name = data.optString("name").trim().takeIf { it.isNotEmpty() }+ ?: return@mapNotNull null+ // Who made it, when that is a person. Nearly every one of these+ // is the service's own, and its name under every cover would say+ // the same word six times.+ val owner = data.optJSONObject("ownerV2")?.optJSONObject("data")+ ?.optString("name").orEmpty()+ SearchItem(+ uri = uri,+ title = name,+ subtitle = owner.takeUnless { it == "Spotify" }.orEmpty(),+ artworkUrl = data.optJSONObject("images")+ ?.optJSONArray("items")?.optJSONObject(0)+ ?.optJSONArray("sources")?.optJSONObject(0)+ ?.optString("url")?.takeIf { it.isNotEmpty() },+ )+ }+ }.distinctBy { it.uri }+ }.getOrNull()+}diff --git a/app/src/main/java/dev/lelonio/square/data/SpotifyHome.kt b/app/src/main/java/dev/lelonio/square/data/SpotifyHome.ktindex f5e4202..d4bb9a4 100644--- a/app/src/main/java/dev/lelonio/square/data/SpotifyHome.kt+++ b/app/src/main/java/dev/lelonio/square/data/SpotifyHome.kt@@ -13,6 +13,21 @@ import org.json.JSONObjectdata class HomeShelf(val title: String,val items: List<CatalogPlaylist>,+ /**+ * The section's address, "spotify:section:…", where it came with one.+ *+ * The same for every account and in every language, which is what tells+ * the row of what was being played from the rest without reading a title;+ * see TabContents.+ */+ val sectionUri: String = "",+ /**+ * Gathered out of the single-tile sections at the foot of Spotify's home+ * rather than given as a row; see [SpotifyHome.parse].+ */+ val gathered: Boolean = false,+ /** The artist the row is about, "For fans of", "More like", where it said. */+ val artist: String? = null,)/**@@ -36,20 +51,38 @@ object SpotifyHome {.getJSONObject("sections").getJSONArray("items")- (0 until sections.length()).mapNotNull { index ->- shelf(sections.getJSONObject(index))+ val rows = mutableListOf<HomeShelf>()+ val gathered = LinkedHashMap<String, HomeShelf>()+ for (index in 0 until sections.length()) {+ val section = sections.getJSONObject(index)+ val baseline = section.optJSONObject("data")?.optString("__typename") == BASELINE+ if (!baseline) {+ shelf(section)?.let(rows::add)+ continue+ }+ // The endless feed at the bottom of Spotify's own home: dozens of+ // sections holding a single tile each, several of them titled the+ // same. One tile is not a row, so they are put back together: by+ // the artist a section is about when it names one ("For fans of+ // Geolier" twice is one row), and by title when it does not ("Just+ // for you" five times is one row).+ val one = shelf(section) ?: continue+ val artist = section.optJSONObject("data")+ ?.optJSONObject("headerEntity")+ ?.optJSONObject("data")+ ?.optString("uri")+ ?.takeIf { it.startsWith("spotify:artist:") }+ val key = artist ?: "title:${one.title}"+ val so = gathered[key]+ gathered[key] = so?.copy(items = (so.items + one.items).distinctBy { it.uri })+ ?: one.copy(sectionUri = "", gathered = true, artist = artist)}+ rows + gathered.values}.getOrDefault(emptyList())private fun shelf(section: JSONObject): HomeShelf? {val data = section.optJSONObject("data") ?: return null- // The endless feed at the bottom of Spotify's own home: dozens of- // sections holding a single item each, several of them titled the same.- // A carousel of one tile is not a row, and repeating "Made for you"- // eight times down a page is not a home.- if (data.optString("__typename") == BASELINE) return null-val title = data.optJSONObject("title")?.optString("transformedLabel").orEmpty()if (title.isEmpty()) return null@@ -58,7 +91,7 @@ object SpotifyHome {val entries = (0 until items.length()).mapNotNull { index ->entry(items.getJSONObject(index))}- return if (entries.isEmpty()) null else HomeShelf(title, entries)+ return if (entries.isEmpty()) null else HomeShelf(title, entries, section.optString("uri"))}private fun entry(item: JSONObject): CatalogPlaylist? {diff --git a/app/src/main/java/dev/lelonio/square/data/TabContents.kt b/app/src/main/java/dev/lelonio/square/data/TabContents.ktnew file mode 100644index 0000000..5967998--- /dev/null+++ b/app/src/main/java/dev/lelonio/square/data/TabContents.kt@@ -0,0 +1,181 @@+package dev.lelonio.square.data++/**+ * Which tab each of Spotify's rows belongs to, so that nothing is shown twice.+ *+ * Home, New and Radio are all built out of the same gateway, and they used to+ * be kept apart by row title alone. Spotify files the same playlists under+ * different titles on different pages, so the daily mixes, Release Radar, the+ * genre mixes and the daylist all turned up on two tabs at once. Each tab now+ * answers its own question, and a playlist goes to the one whose question it+ * answers:+ *+ * - Home, what is for me now: what was being played, what Spotify made for+ * this account (Discover Weekly, the daily mixes), the day's own soundtrack,+ * the blends, and the "more like" rows;+ * - New, what is out and what is being played: new releases, Release Radar,+ * the charts;+ * - Radio, listening that does not stop: every station and every mix.+ *+ * What a playlist is comes from its ID. Spotify's generated lists keep their+ * kind in a prefix, and titles are no use for it: they are in the listener's+ * language and change with the time of day.+ */+object TabContents {++ data class Tabs(+ val home: List<HomeShelf> = emptyList(),+ val new: List<HomeShelf> = emptyList(),+ val radio: List<HomeShelf> = emptyList(),+ )++ enum class Kind { STATION, MIX, DAILY_MIX, DAYLIST, BLEND, RELEASE, OTHER }++ fun kind(item: CatalogPlaylist): Kind {+ val id = item.uri.removePrefix(PLAYLIST)+ if (id == item.uri) return Kind.OTHER+ return when {+ // "Radio di …", one for each artist.+ id.startsWith("37i9dQZF1E4") -> Kind.STATION+ id.startsWith("37i9dQZF1E3") -> Kind.DAILY_MIX+ id.startsWith("37i9dQZF1EP") -> Kind.DAYLIST+ id.startsWith("37i9dQZF1EJ") -> Kind.BLEND+ // By genre and decade, by artist and niche, and by mood.+ id.startsWith("37i9dQZF1EQ") || id.startsWith("37i9dQZF1EI") ||+ id.startsWith("37i9dQZF1EV") -> Kind.MIX+ // Its ID is the account's own, but not its name, in any language.+ item.name == "Release Radar" || item.name.startsWith("New Music Friday") ->+ Kind.RELEASE+ else -> Kind.OTHER+ }+ }++ /**+ * The three tabs out of Spotify's four sources.+ *+ * [home] is the personalised home; [releases], [charts] and [madeForYou]+ * are browse pages. Any of them can be empty, and the tabs are built from+ * whatever has arrived.+ */+ fun split(+ home: List<HomeShelf>,+ releases: List<HomeShelf>,+ charts: List<HomeShelf>,+ madeForYou: List<HomeShelf>,+ ): Tabs {+ // Rows that are mostly stations are Radio's, wherever they turn up.+ val stationRows = home.filter { share(it, Kind.STATION) >= MOSTLY }+ val onRadioStations = stationRows.flatMapTo(mutableSetOf()) { row -> row.items.map { it.uri } }+ val chartUris = charts.flatMapTo(mutableSetOf()) { row -> row.items.map { it.uri } }++ // From "made for you", what is personal comes home: the day's list and+ // the blends. The mixes go to Radio. The daily mixes stay where Spotify+ // puts them, on Home's own row, and the rest (videos, concerts near+ // you) is not music to put on.+ val personal = madeForYou.filter { row ->+ row.items.any { kind(it) == Kind.DAYLIST || kind(it) == Kind.BLEND }+ }+ val mixRows = madeForYou.filter { share(it, Kind.MIX) >= MOSTLY }++ // Home: Spotify's rows, less the stations and the rows of favourite+ // mixes, which Radio has whole. The day's soundtrack stays: it is+ // mixes, but the day's own, and it comes with the daylist.+ val homeRows = (home - stationRows.toSet())+ .filterNot { share(it, Kind.MIX) >= MOSTLY && it.items.none { item -> kind(item) == Kind.DAYLIST } }+ .plus(personal)+ .map { row ->+ // What was being played is the listener's own, so it stays as+ // Spotify gave it.+ if (row.sectionUri == RECENTS) row+ else {+ // A mix is Radio's wherever it turns up, except in the+ // day's own soundtrack, which comes with the daylist.+ val soundtrack = row.items.any { kind(it) == Kind.DAYLIST }+ row.copy(+ items = row.items.filterNot {+ kind(it) == Kind.RELEASE || it.uri in chartUris ||+ it.uri in onRadioStations || (kind(it) == Kind.MIX && !soundtrack)+ },+ )+ }+ }+ .distinctItems()+ .filter { it.items.size >= MIN_ITEMS }++ // What Home shows leaves the other tabs, except what was being+ // played: a mix or a chart heard yesterday is still Radio's and New's.+ val onHome = homeRows.filter { it.sectionUri != RECENTS }+ .flatMapTo(mutableSetOf()) { row -> row.items.map { it.uri } }++ val radioRows = (stationRows + mixRows)+ .map { row -> row.copy(items = row.items.filterNot { it.uri in onHome }) }+ .distinctItems()+ .filter { it.items.size >= MIN_ITEMS }++ val newRows = (releases + charts)+ .map { row -> row.copy(items = row.items.filterNot { it.uri in onHome }) }+ .distinctItems()+ .filter { it.items.size >= MIN_ITEMS }++ return Tabs(home = homeRows, new = newRows, radio = radioRows)+ }++ /** The chips on Home: what is made for this account, what is new to it, and whose. */+ enum class Chip { FOR_YOU, DISCOVER, ARTISTS }++ /**+ * Which chip a row of Home's goes under, or none for what was being played,+ * which only the whole page shows.+ *+ * A row about an artist says so: gathered ones name the artist, and+ * Spotify's own "more like" rows lead with that artist's radio and carry+ * artists and albums. Rows of what Spotify made for the account carry the+ * lists only it has (Discover Weekly, the daily mixes, the daylist, the+ * blends, the throwbacks), and what was gathered from the single tiles is+ * Spotify's "just for you" and "based on what you listened to". The rest+ * is the editors'.+ */+ fun chipOf(row: HomeShelf): Chip? = when {+ row.sectionUri == RECENTS -> null+ row.artist != null -> Chip.ARTISTS+ row.gathered -> Chip.FOR_YOU+ row.items.any { personal(it) } -> Chip.FOR_YOU+ row.items.any { it.uri.startsWith("spotify:artist:") } ||+ row.items.firstOrNull()?.let { kind(it) == Kind.STATION } == true -> Chip.ARTISTS+ else -> Chip.DISCOVER+ }++ /** One of the lists Spotify makes for a single account. */+ private fun personal(item: CatalogPlaylist): Boolean {+ val id = item.uri.removePrefix(PLAYLIST)+ return kind(item) in setOf(Kind.DAILY_MIX, Kind.DAYLIST, Kind.BLEND) ||+ // Discover Weekly, and the throwbacks and "on repeat" ones.+ id.startsWith("37i9dQZEVXc") || id.startsWith("37i9dQZF1Ep") || id.startsWith("37i9dQZF1CA")+ }++ /** Each playlist once per tab, in the first row that has it. */+ private fun List<HomeShelf>.distinctItems(): List<HomeShelf> {+ val seen = mutableSetOf<String>()+ return map { row -> row.copy(items = row.items.filter { seen.add(it.uri) }) }+ }++ private fun share(row: HomeShelf, kind: Kind): Float =+ if (row.items.isEmpty()) 0f else row.items.count { kind(it) == kind }.toFloat() / row.items.size++ /** What "mostly" means for a row: one odd tile does not change what it is. */+ private const val MOSTLY = 0.8f++ /** A carousel of one tile is not a row. */+ private const val MIN_ITEMS = 2++ /**+ * The section Spotify's home puts what was being played in, "Jump back in".+ *+ * Its type says nothing, every row on the home is the same generic one, so+ * it is known by its address, which Spotify gives the same section on every+ * account.+ */+ const val RECENTS = "spotify:section:0JQ5DAIiKWzVFULQfUm85X"++ private const val PLAYLIST = "spotify:playlist:"+}diff --git a/app/src/main/java/dev/lelonio/square/playback/MediaBrowseTree.kt b/app/src/main/java/dev/lelonio/square/playback/MediaBrowseTree.ktindex 4a5e311..11967f4 100644--- a/app/src/main/java/dev/lelonio/square/playback/MediaBrowseTree.kt+++ b/app/src/main/java/dev/lelonio/square/playback/MediaBrowseTree.kt@@ -104,37 +104,33 @@ class MediaBrowseTree(fun layoutFor(player: androidx.media3.common.Player,/**- * The shade has room for two buttons beside the transport and is looked- * at rather than operated: the shade shows a heart to add to Liked Songs- * (Tus me gusta) instead of repeat, which is a setting people change once.- * The car keeps repeat, because there it is the mode a driver actually reaches for.+ * The buttons of the system's own session, which two places read.+ *+ * The car does not get a layout of its own: Android Auto connects the+ * old way and draws whatever the platform session carries, and that is+ * the shade's. So this one list serves both. The shade has room for+ * two beside the transport and takes the first two, shuffle and the+ * heart; the car has room for more and gets radio after them, which is+ * where it was before the heart arrived and pushed it out. Repeat is a+ * setting people change once, and stays in the app.*/- radioInsteadOfRepeat: Boolean = false,+ shadeAndCar: Boolean = false,isLiked: Boolean? = null,): ImmutableList<CommandButton> {- val currentUri = player.currentMediaItem?.mediaId- val liked = isLiked ?: app.likedStore.isLiked(currentUri)-- return ImmutableList.of(- CommandButton.Builder(- if (player.shuffleModeEnabled) {- CommandButton.ICON_SHUFFLE_ON- } else {- CommandButton.ICON_SHUFFLE_OFF- },- )- .setSessionCommand(SessionCommand(CMD_SHUFFLE, Bundle.EMPTY))- .setDisplayName(strings.getString(R.string.shuffle))- .build(),- if (radioInsteadOfRepeat) {- CommandButton.Builder()- .setIconResId(if (liked) R.drawable.ic_heart_filled else R.drawable.ic_heart_outline)- .setSessionCommand(SessionCommand(CMD_LIKE, Bundle.EMPTY))- .setDisplayName(- strings.getString(if (liked) R.string.remove_from_liked else R.string.liked_songs),- )- .build()+ val shuffle = CommandButton.Builder(+ if (player.shuffleModeEnabled) {+ CommandButton.ICON_SHUFFLE_ON} else {+ CommandButton.ICON_SHUFFLE_OFF+ },+ )+ .setSessionCommand(SessionCommand(CMD_SHUFFLE, Bundle.EMPTY))+ .setDisplayName(strings.getString(R.string.shuffle))+ .build()++ if (!shadeAndCar) {+ return ImmutableList.of(+ shuffle,CommandButton.Builder(when (player.repeatMode) {androidx.media3.common.Player.REPEAT_MODE_ONE ->@@ -146,8 +142,25 @@ class MediaBrowseTree().setSessionCommand(SessionCommand(CMD_REPEAT, Bundle.EMPTY)).setDisplayName(strings.getString(R.string.repeat))- .build()- },+ .build(),+ )+ }++ val currentUri = player.currentMediaItem?.mediaId+ val liked = isLiked ?: app.likedStore.isLiked(currentUri)+ return ImmutableList.of(+ shuffle,+ CommandButton.Builder()+ .setIconResId(if (liked) R.drawable.ic_heart_filled else R.drawable.ic_heart_outline)+ .setSessionCommand(SessionCommand(CMD_LIKE, Bundle.EMPTY))+ .setDisplayName(+ strings.getString(if (liked) R.string.remove_from_liked else R.string.liked_songs),+ )+ .build(),+ CommandButton.Builder(CommandButton.ICON_RADIO)+ .setSessionCommand(SessionCommand(CMD_RADIO, Bundle.EMPTY))+ .setDisplayName(strings.getString(R.string.radio))+ .build(),)}@@ -168,7 +181,7 @@ class MediaBrowseTree(.setCustomLayout(layoutFor(session.player,- radioInsteadOfRepeat = session.isMediaNotificationController(controller),+ shadeAndCar = session.isMediaNotificationController(controller),),).build()@@ -209,7 +222,7 @@ class MediaBrowseTree(ctrl,layoutFor(player,- radioInsteadOfRepeat = session.isMediaNotificationController(ctrl),+ shadeAndCar = session.isMediaNotificationController(ctrl),),)}@@ -230,7 +243,7 @@ class MediaBrowseTree(ctrl,layoutFor(player,- radioInsteadOfRepeat = session.isMediaNotificationController(ctrl),+ shadeAndCar = session.isMediaNotificationController(ctrl),isLiked = nowLiked,),)@@ -255,7 +268,7 @@ class MediaBrowseTree(ctrl,layoutFor(player,- radioInsteadOfRepeat = session.isMediaNotificationController(ctrl),+ shadeAndCar = session.isMediaNotificationController(ctrl),isLiked = revertedLiked,),)diff --git a/app/src/main/java/dev/lelonio/square/playback/PlaybackService.kt b/app/src/main/java/dev/lelonio/square/playback/PlaybackService.ktindex 3183bf4..915697d 100644--- a/app/src/main/java/dev/lelonio/square/playback/PlaybackService.kt+++ b/app/src/main/java/dev/lelonio/square/playback/PlaybackService.kt@@ -54,7 +54,7 @@ class PlaybackService : MediaLibraryService() {controller,browseTree.layoutFor(player,- radioInsteadOfRepeat = live.isMediaNotificationController(controller),+ shadeAndCar = live.isMediaNotificationController(controller),),)}diff --git a/app/src/main/java/dev/lelonio/square/ui/MainViewModel.kt b/app/src/main/java/dev/lelonio/square/ui/MainViewModel.ktindex a32dc20..f0a410c 100644--- a/app/src/main/java/dev/lelonio/square/ui/MainViewModel.kt+++ b/app/src/main/java/dev/lelonio/square/ui/MainViewModel.kt@@ -167,6 +167,8 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {val appearsOn: List<SearchItem> = emptyList(),/** The playlists Spotify built around them, "This Is" first. */val artistPlaylists: List<SearchItem> = emptyList(),+ /** Lists like this one, for the row under a playlist's songs. */+ val relatedPlaylists: List<SearchItem> = emptyList(),/** Fans also like / related artists. */val relatedArtists: List<SearchItem> = emptyList(),/** Whether the artist is verified. */@@ -2244,6 +2246,9 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {inkHex = state.inkHex ?: current.inkHex,heroAspect = state.heroAspect ?: current.heroAspect,motionUrl = state.motionUrl ?: current.motionUrl,+ // The row under the songs, for the same reason: the list is+ // read from a copy of the page taken before the row arrived.+ relatedPlaylists = state.relatedPlaylists.ifEmpty { current.relatedPlaylists },// Owned by the lookup alone: every other publish carries the// flag's default and would clear the wait a batch of tracks// early, which is the swap this exists to prevent.@@ -2510,18 +2515,35 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {* one the app can do without. Everything below it is read the old way and* does not depend on this at all.*/- val homeShelves: StateFlow<List<HomeShelf>> = _homeShelves.asStateFlow()+ private val _releasesPage = MutableStateFlow<List<HomeShelf>>(emptyList())+ private val _chartsPage = MutableStateFlow<List<HomeShelf>>(emptyList())+ private val _madeForYouPage = MutableStateFlow<List<HomeShelf>>(emptyList())- private val _newBrowse = MutableStateFlow<List<dev.lelonio.square.data.HomeShelf>>(emptyList())-- /** Spotify's own new-releases page, as rows; see SpotifyBrowse. */- val newBrowse: StateFlow<List<dev.lelonio.square.data.HomeShelf>> = _newBrowse.asStateFlow()-- private val _radioBrowse =- MutableStateFlow<List<dev.lelonio.square.data.HomeShelf>>(emptyList())-- /** And its "made for you" and charts pages, which is what a radio tab is. */- val radioBrowse: StateFlow<List<dev.lelonio.square.data.HomeShelf>> = _radioBrowse.asStateFlow()+ /**+ * The three tabs, out of the four things Spotify answers.+ *+ * Worked out together because they share one rule, that no playlist is on+ * two of them; see TabContents. Each source updates it as it arrives.+ */+ private val tabs: StateFlow<dev.lelonio.square.data.TabContents.Tabs> = combine(+ _homeShelves,+ _releasesPage,+ _chartsPage,+ _madeForYouPage,+ ) { home, releases, charts, madeForYou ->+ dev.lelonio.square.data.TabContents.split(home, releases, charts, madeForYou)+ }.stateIn(viewModelScope, SharingStarted.Eagerly, dev.lelonio.square.data.TabContents.Tabs())++ val homeShelves: StateFlow<List<HomeShelf>> = tabs.map { it.home }+ .stateIn(viewModelScope, SharingStarted.Eagerly, emptyList())++ /** What is out and what is being played: new releases and the charts. */+ val newBrowse: StateFlow<List<HomeShelf>> = tabs.map { it.new }+ .stateIn(viewModelScope, SharingStarted.Eagerly, emptyList())++ /** Listening that does not stop: every station and every mix. */+ val radioBrowse: StateFlow<List<HomeShelf>> = tabs.map { it.radio }+ .stateIn(viewModelScope, SharingStarted.Eagerly, emptyList())private var browseJob: Job? = null@@ -2546,37 +2568,34 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {* what the catalogue is offering: the releases picked for this listener,* the editors' lists, the charts, the mixes.*- * Whatever the home page is already showing is dropped here, by title: the- * two do overlap, and a row that appears twice in one app is worse than a- * row that appears once.+ * What goes on which tab is decided in one place for all three, by what+ * each playlist is rather than by the title of the row it came in; see+ * TabContents. Home reads these pages too: the blends and the day's own+ * list are on "made for you", and the charts are how it knows to leave+ * them to New.*/fun loadBrowse() {if (browseJob?.isActive == true) return- if (_newBrowse.value.isNotEmpty() && _radioBrowse.value.isNotEmpty()) return+ if (_releasesPage.value.isNotEmpty() && _madeForYouPage.value.isNotEmpty()) return_browseLoading.value = truebrowseJob = viewModelScope.launch {- val onHome = _homeShelves.value.map { it.title.lowercase() }.toSet()suspend fun page(uri: String) = withContext(Dispatchers.IO) {container.gateway.browsePage(uri)?.let { dev.lelonio.square.data.SpotifyBrowse.parse(it) }.orEmpty()- .filter { it.title.lowercase() !in onHome }}- val releases = page(dev.lelonio.square.data.SpotifyBrowse.Pages.NEW_RELEASES)- if (releases.isNotEmpty()) _newBrowse.value = releases-- // Two pages behind one tab: the mixes made for this listener, and- // the charts, which are the other half of what a radio is for.- val mixes = page(dev.lelonio.square.data.SpotifyBrowse.Pages.MADE_FOR_YOU)- val charts = page(dev.lelonio.square.data.SpotifyBrowse.Pages.CHARTS)- val forRadio = (mixes + charts).distinctBy { it.title.lowercase() }- if (forRadio.isNotEmpty()) _radioBrowse.value = forRadio+ page(dev.lelonio.square.data.SpotifyBrowse.Pages.NEW_RELEASES)+ .takeIf { it.isNotEmpty() }?.let { _releasesPage.value = it }+ page(dev.lelonio.square.data.SpotifyBrowse.Pages.MADE_FOR_YOU)+ .takeIf { it.isNotEmpty() }?.let { _madeForYouPage.value = it }+ page(dev.lelonio.square.data.SpotifyBrowse.Pages.CHARTS)+ .takeIf { it.isNotEmpty() }?.let { _chartsPage.value = it }android.util.Log.i(TAG,- "browse: ${releases.size} rows for new, ${forRadio.size} for radio",+ "browse: ${newBrowse.value.size} rows for new, ${radioBrowse.value.size} for radio",)_browseLoading.value = false}@@ -2613,6 +2632,8 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {if (shelves.isNotEmpty()) {android.util.Log.i(TAG, "home: ${shelves.size} shelves from the gateway")_homeShelves.value = shelves+ // The browse pages as well: part of Home is on them; see loadBrowse.+ loadBrowse()}}@@ -2932,6 +2953,13 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {size > 30}+ /** The row under each playlist opened this run, so reopening one asks nothing. */+ private val relatedCache =+ object : LinkedHashMap<String, List<SearchItem>>(0, 0.75f, true) {+ override fun removeEldestEntry(eldest: Map.Entry<String, List<SearchItem>>) =+ size > 30+ }+// ------------------------------------------------------------ downloads/** What is on the phone, per track; see DownloadStore. */@@ -3311,6 +3339,26 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {base = base.copy(saved = kept)}+ // Lists like this one, for the row under the songs. Written through+ // `base` like the rest, and quiet like the rest: the page is whole+ // without it, and a list Spotify has nothing to pair with simply+ // ends where its songs do.+ if (kind == DetailKind.PLAYLIST && playlist.uri.startsWith("spotify:playlist:") &&+ !dev.lelonio.square.playback.OfflineMode.active.value+ ) launch {+ val related = relatedCache[playlist.uri]+ ?: container.gateway.relatedPlaylists(playlist.uri)+ ?.filter { it.uri != playlist.uri }+ ?.also { relatedCache[playlist.uri] = it }+ ?: return@launch+ android.util.Log.i(TAG, "related playlists for ${playlist.uri}: ${related.size}")+ if (related.isEmpty()) return@launch+ base = base.copy(relatedPlaylists = related)+ if (isActive && _playlist.value.uri == playlist.uri) {+ _playlist.value = _playlist.value.copy(relatedPlaylists = related)+ }+ }+// Apple's own pictures for the page. Deliberately last and// deliberately quiet: it is a different catalogue reached over a// different network, everything on screen is already correct@@ -3390,6 +3438,25 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {}}}++ // The playlists after the page too, and for the same+ // reason: "This Is" and the rest are a row near the foot of+ // it, and a second request is not worth holding the top for.+ // The call that used to fill them went when this page's+ // loading was rewritten, and the row went with it.+ if (page.playlists.isEmpty()) {+ launch {+ val lists = artistPlaylistsFor(+ playlist.uri,+ page.name?.takeIf { it.isNotEmpty() } ?: base.name,+ )+ if (lists.isEmpty()) return@launch+ artistPageCache[playlist.uri] = page.copy(playlists = lists)+ if (isActive && _playlist.value.uri == playlist.uri) {+ _playlist.value = _playlist.value.copy(artistPlaylists = lists)+ }+ }+ }} else if (cached.isNotEmpty() && isUnchanged(playlist.uri, entry?.snapshotId)) {// Nothing to do: one small request said the copy on screen// is the current one.@@ -4621,13 +4688,22 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {}/**- * The playlists Spotify built around one artist.+ * The playlists an artist is in, "This Is" first.+ *+ * Read from the gateway, which answers with the row the desktop client+ * heads "Featuring"; see [dev.lelonio.square.data.ArtistPlaylists]. The+ * search below is what is left when the gateway will not answer.+ */+ private suspend fun artistPlaylistsFor(uri: String, name: String): List<SearchItem> =+ container.gateway.artistPlaylists(uri)?.takeIf { it.isNotEmpty() }+ ?: if (container.webApi.isReady) artistPlaylists(name) else emptyList()++ /**+ * The playlists Spotify built around one artist, by searching for them.*- * There is no endpoint for this. The desktop client reads it from the- * gateway that answers the personalised pages, addressed by a hash of a- * query this app does not have, so the way in is the search: "This Is" and- * the rest are ordinary public playlists, and what makes them Spotify's own- * rather than a stranger's copy is the owner.+ * The fallback for [artistPlaylistsFor]: "This Is" and the rest are+ * ordinary public playlists, and what makes them Spotify's own rather than+ * a stranger's copy is the owner.** Named after the artist too, because searching a name returns everything* anybody ever titled after them.diff --git a/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt b/app/src/main/java/dev/lelonio/square/ui/SquareApp.ktindex 45bdca8..34380b6 100644--- a/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt+++ b/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.RowScopeimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.WindowInsetsimport androidx.compose.foundation.layout.asPaddingValues+import androidx.compose.foundation.layout.aspectRatioimport androidx.compose.foundation.layout.fillMaxHeightimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidth@@ -766,6 +767,16 @@ fun SquareApp(// and the glass, which still reads it, always takes its dark film.val playerInk = Color(0xFFF7F8FA)+ // And the film on its glass: still dark, and now the record's own dark.+ // The song's colour at the depth the grey film sat at, see playerFilmTint,+ // eased from one song to the next rather than cut, like the field under it.+ val playerFilm by animateColorAsState(+ targetValue = accent?.let { dev.lelonio.square.ui.player.playerFilmTint(it) }+ ?: Color(0xFF23232A),+ animationSpec = tween(PLAYER_FILM_FADE_MS),+ label = "playerFilm",+ )+// Emptied by the track change itself, not by the answer about the new// track's Canvas.//@@ -1075,9 +1086,16 @@ fun SquareApp(// fresh when the mode is entered, and a surface attached to the// one before it shows nothing at all.player?.let {+ val key = if (spotifyVideoOn) spotifyVideoGeneration else null+ // Fitted, not filled: the system clamps the window's+ // shape, and a picture wider than it allows was stretched+ // to the window.dev.lelonio.square.ui.player.VideoSurface(it,- attachKey = if (spotifyVideoOn) spotifyVideoGeneration else null,+ attachKey = key,+ modifier = Modifier.aspectRatio(+ dev.lelonio.square.ui.player.rememberVideoRatio(it, key),+ ),)}}@@ -1489,7 +1507,6 @@ fun SquareApp(onRetryOnline = viewModel::retryOnline,youtubeHome = youtubeHome,shelves = homeShelves,- mixShelves = radioShelves,onPlayTrending = { tracks, index ->onPlay(tracks, index, null, false, trendingLabel, 0L)},@@ -1606,6 +1623,7 @@ fun SquareApp(},history = searchTrail,onClearHistory = viewModel::clearSearchHistory,+ onRemoveHistory = { uri -> viewModel.forgetSearchPlay(uri) },offline = offlineNow,onEnqueue = onEnqueue,onTrackMenu = { track ->@@ -2658,6 +2676,17 @@ fun SquareApp(// playerInk above and GlassEffect.dev.lelonio.square.ui.theme.LocalInkOverride provides playerInk,androidx.compose.material3.LocalContentColor provides playerInk,+ // The record's film, to the panes that draw their+ // own and, through the config, to the ones the+ // glass recipe fills. A colour set by hand in the+ // settings still wins, as it does everywhere.+ dev.lelonio.square.ui.player.LocalPlayerFilm provides+ playerFilm.copy(alpha = 0.5f),+ dev.lelonio.square.ui.glass.LocalGlassEffectConfig provides+ dev.lelonio.square.ui.glass.LocalGlassEffectConfig.current.let {+ if (it.surfaceTintColor.isSpecified) it+ else it.copy(surfaceTintColor = playerFilm)+ },) {PlayerScreen(state = playerState,@@ -2931,19 +2960,6 @@ fun SquareApp(videoOn = videoOn || spotifyVideoOn,videoPlayer = player,videoAttachKey = spotifyVideoGeneration,- onMore = playback.mediaId?.let { uri ->- {- trackMenu = TrackMenuRequest(- track = CatalogTrack(- uri = uri,- name = playback.title,- artist = playback.artist,- artworkUrl = playback.artworkUrl,- ),- removable = false,- )- }- },)}},@@ -3658,15 +3674,16 @@ private fun NavHostController.openPlaylist(viewModel: MainViewModel, playlist: C* stack forever and the system back button would walk the entire history.*//**- * What the player says the track is coming from: "Playlist · Estate 2025".+ * What the player says the track is coming from: "Estate 2025".*- * The kind first, because the name alone reads as a title and the two are worth- * telling apart at a glance while a cover is filling the screen.+ * The name alone. The kind in front of it took the room a long name needs at+ * the top of the player, and the name is what tells one list from another;+ * the kind is what shows when there is no name to give.*/@Composableprivate fun MainViewModel.PlaylistState.sourceLabel(): String {val kindName = stringResource(kind.label)- return if (name.isBlank()) kindName else "$kindName · $name"+ return name.ifBlank { kindName }}private fun NavHostController.switchTab(route: String) {@@ -3918,3 +3935,6 @@ private suspend fun awaitAudible(/** How long the extras wait for the song; see [awaitAudible]. */private const val AUDIBLE_TIMEOUT_MS = 5_000L++/** How long the player's glass takes to become the next song's colour. */+private const val PLAYER_FILM_FADE_MS = 700diff --git a/app/src/main/java/dev/lelonio/square/ui/components/SwipeToQueue.kt b/app/src/main/java/dev/lelonio/square/ui/components/SwipeToQueue.ktindex a093637..cb550dd 100644--- a/app/src/main/java/dev/lelonio/square/ui/components/SwipeToQueue.kt+++ b/app/src/main/java/dev/lelonio/square/ui/components/SwipeToQueue.kt@@ -17,8 +17,10 @@ import androidx.compose.material3.Iconimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Textimport androidx.compose.runtime.Composable+import androidx.compose.runtime.getValueimport androidx.compose.runtime.rememberimport androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.rememberUpdatedStateimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.res.stringResource@@ -34,6 +36,7 @@ import kotlin.math.roundToIntimport com.adamglin.PhosphorIconsimport com.adamglin.phosphoricons.Regularimport com.adamglin.phosphoricons.regular.Queue+import com.adamglin.phosphoricons.regular.Trash/*** Wraps a row so dragging it to the left queues the track.@@ -47,17 +50,27 @@ import com.adamglin.phosphoricons.regular.Queue* The row springs back either way; the action fires once, on release, past a* threshold. Committing partway through the drag would fire on every* accidental brush of the list.+ *+ * Dragging it to the right removes it, where the list allows that: the recent+ * searches are the one list whose rows are the listener's to throw away. That+ * direction is the deletion the note above is not, so the row goes with it,+ * sliding off the side it was pushed towards. Either action can be left out,+ * and the row then does not move that way at all.*/@Composablefun SwipeToQueue(- onQueue: () -> Unit,+ onQueue: (() -> Unit)?,modifier: Modifier = Modifier,+ onRemove: (() -> Unit)? = null,content: @Composable () -> Unit,) {val offset = remember { Animatable(0f) }val scope = rememberCoroutineScope()val haptics = LocalHapticFeedback.currentval density = LocalDensity.current+ // Read at release rather than captured when the gesture was set up.+ val queue by rememberUpdatedState(onQueue)+ val remove by rememberUpdatedState(onRemove)val threshold = with(density) { THRESHOLD.toPx() }val maximum = with(density) { MAX_DRAG.toPx() }@@ -68,24 +81,26 @@ fun SwipeToQueue(// noise.val progress = (abs(offset.value) / threshold).coerceIn(0f, 1f)if (progress > 0f) {+ val removing = offset.value > 0f+ val tint = if (removing) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.primaryRow(Modifier.matchParentSize().padding(horizontal = 30.dp).graphicsLayer { alpha = progress },- horizontalArrangement = Arrangement.End,+ horizontalArrangement = if (removing) Arrangement.Start else Arrangement.End,verticalAlignment = Alignment.CenterVertically,) {Icon(- PhosphorIcons.Regular.Queue,+ if (removing) PhosphorIcons.Regular.Trash else PhosphorIcons.Regular.Queue,contentDescription = null,- tint = MaterialTheme.colorScheme.primary,+ tint = tint,modifier = Modifier.size(20.dp),)Text(- stringResource(R.string.queued),+ stringResource(if (removing) R.string.delete else R.string.queued),style = MaterialTheme.typography.labelLarge,- color = MaterialTheme.colorScheme.primary,+ color = tint,modifier = Modifier.padding(start = 8.dp),)}@@ -96,23 +111,41 @@ fun SwipeToQueue(.fillMaxWidth().graphicsLayer { translationX = offset.value }.background(MaterialTheme.colorScheme.background)- .pointerInput(Unit) {+ .pointerInput(onQueue != null, onRemove != null) {detectHorizontalDragGestures(onDragEnd = {- val commit = -offset.value >= threshold- if (commit) {- haptics.performHapticFeedback(HapticFeedbackType.LongPress)- onQueue()+ val queueNow = queue+ val removeNow = remove+ when {+ queueNow != null && -offset.value >= threshold -> {+ haptics.performHapticFeedback(HapticFeedbackType.LongPress)+ queueNow()+ scope.launch { offset.animateTo(0f, tween(220)) }+ }+ removeNow != null && offset.value >= threshold -> {+ haptics.performHapticFeedback(HapticFeedbackType.LongPress)+ // Off the edge first, then out of the list:+ // gone at once, it read as a row that had+ // jumped rather than one that was thrown.+ scope.launch {+ offset.animateTo(size.width.toFloat(), tween(180))+ removeNow()+ }+ }+ else -> scope.launch { offset.animateTo(0f, tween(220)) }}- scope.launch { offset.animateTo(0f, tween(220)) }},onDragCancel = { scope.launch { offset.animateTo(0f, tween(220)) } },) { change, dragAmount ->change.consume()- // Left only, and increasingly resistant: the row can be- // pulled clearly past the threshold but never far enough- // to look like it is being torn out of the list.- val next = (offset.value + dragAmount).coerceIn(-maximum, 0f)+ // Only the ways this row allows, and increasingly+ // resistant: the row can be pulled clearly past the+ // threshold but never far enough to look like it is+ // being torn out of the list.+ val next = (offset.value + dragAmount).coerceIn(+ if (onQueue != null) -maximum else 0f,+ if (onRemove != null) maximum else 0f,+ )scope.launch { offset.snapTo(next) }}},diff --git a/app/src/main/java/dev/lelonio/square/ui/glass/floatingtabbar/FloatingTabBar.kt b/app/src/main/java/dev/lelonio/square/ui/glass/floatingtabbar/FloatingTabBar.ktindex 06ac06e..a79fd85 100644--- a/app/src/main/java/dev/lelonio/square/ui/glass/floatingtabbar/FloatingTabBar.kt+++ b/app/src/main/java/dev/lelonio/square/ui/glass/floatingtabbar/FloatingTabBar.kt@@ -455,7 +455,7 @@ private fun SharedTransitionScope.SearchExpandedBar(inlineTab = inlineTab,// Already open: a tap here navigates, and does not have to// unfold anything.- onInlineTabClick = {},+ onClick = inlineTab.onClick,shapes = shapes,sizes = sizes,colors = colors,@@ -667,7 +667,7 @@ private fun SharedTransitionScope.InlineBar(if (hasInlineTab) {InlineTab(inlineTab = inlineTab,- onInlineTabClick = onInlineTabClick,+ onClick = onInlineTabClick,shapes = shapes,sizes = sizes,colors = colors,@@ -724,7 +724,12 @@ private fun SharedTransitionScope.InlineBar(@Composableprivate fun SharedTransitionScope.InlineTab(inlineTab: FloatingTabBarTab,- onInlineTabClick: () -> Unit,+ // LOCAL CHANGE: what a tap does, chosen by the caller. Upstream unfolds the+ // bar and then runs the tab's own click as well, and the tab's click is a+ // navigation: on a page opened from a tab, a tap that was meant to bring+ // the bar back took you off the page. Folded, it unfolds and nothing else;+ // beside the search field, where there is nothing to unfold, it navigates.+ onClick: () -> Unit,shapes: FloatingTabBarShapes,sizes: FloatingTabBarSizes,colors: FloatingTabBarColors,@@ -756,10 +761,7 @@ private fun SharedTransitionScope.InlineTab(.clip(shapes.tabBarShape).then(tabBarContentModifier).clickable(- onClick = {- onInlineTabClick()- inlineTab.onClick()- },+ onClick = onClick,indication = inlineTab.indication?.invoke(),interactionSource = remember { MutableInteractionSource() })diff --git a/app/src/main/java/dev/lelonio/square/ui/home/HomeScreen.kt b/app/src/main/java/dev/lelonio/square/ui/home/HomeScreen.ktindex 7e35114..6e2235a 100644--- a/app/src/main/java/dev/lelonio/square/ui/home/HomeScreen.kt+++ b/app/src/main/java/dev/lelonio/square/ui/home/HomeScreen.kt@@ -96,13 +96,17 @@ import java.util.Calendar* and "Tutto" is genuinely the whole thing rather than a fourth view. The* sections keep their order in every one of them, so switching never rearranges* what stays on screen.+ *+ * Each chip is a part of Spotify's own home: what it made for the account,+ * what the editors put there, and the rows about an artist; see+ * TabContents.chipOf. There used to be a chip for the library and one for new+ * releases, which were two other tabs of this app said again on this one.*/-private enum class Feed(@StringRes val label: Int) {- ALL(R.string.feed_all),- FOR_YOU(R.string.feed_for_you),- LIBRARY(R.string.library),- RELEASES(R.string.feed_releases),- ARTISTS(R.string.artists),+private enum class Feed(@StringRes val label: Int, val chip: dev.lelonio.square.data.TabContents.Chip?) {+ ALL(R.string.feed_all, null),+ FOR_YOU(R.string.feed_for_you, dev.lelonio.square.data.TabContents.Chip.FOR_YOU),+ DISCOVER(R.string.feed_discover, dev.lelonio.square.data.TabContents.Chip.DISCOVER),+ ARTISTS(R.string.artists, dev.lelonio.square.data.TabContents.Chip.ARTISTS),}/**@@ -162,7 +166,6 @@ fun HomeScreen(* cannot be reconstructed from the account's playlists.*/shelves: List<dev.lelonio.square.data.HomeShelf> = emptyList(),- mixShelves: List<dev.lelonio.square.data.HomeShelf> = emptyList(),) {if (youtubeMode) {YouTubeHome(@@ -219,7 +222,16 @@ fun HomeScreen(// page that forgets which shelf you were reading is the same// complaint as one that forgets where you were in it.var filterName by rememberSaveable { mutableStateOf(Feed.ALL.name) }- val filter = Feed.entries.firstOrNull { it.name == filterName } ?: Feed.ALL+ // Only the chips that have something under them, and none at all+ // when Spotify's home did not answer: the page is then this app's+ // own sections, which is one view with nothing to filter.+ val chips = remember(shelves) {+ listOf(Feed.ALL) + Feed.entries.filter { entry ->+ entry.chip != null &&+ shelves.any { dev.lelonio.square.data.TabContents.chipOf(it) == entry.chip }+ }+ }+ val filter = chips.firstOrNull { it.name == filterName } ?: Feed.ALL// Read once here rather than inside the rows: the label travels// with the play so the player can say where the song came from,// and that is a plain string by the time it leaves this screen.@@ -290,6 +302,8 @@ fun HomeScreen(backdrop = backdrop,topPadding = contentPadding.calculateTopPadding(),onFilter = { filterName = it.name },+ chips = chips,+ showFilters = chips.size > 1,onOpenSettings = onOpenSettings,friends = friends,onOpenFriends = onOpenFriends,@@ -311,13 +325,14 @@ fun HomeScreen(// page it could not read: what the account plays most, what it// came back to, new releases. Once the real one arrives they// are a second, worse answer to the same question, printed- // underneath the first. They keep their own chips, so nothing- // is lost — only the pile on the front page.+ // underneath the first, so they stand in only while there is+ // no real one; the chips are the real one's.val ownFeed = shelves.isEmpty()- val showReleases = (current == Feed.ALL && ownFeed) || current == Feed.RELEASES- val showArtists = (current == Feed.ALL && ownFeed) || current == Feed.ARTISTS- val showLibrary = (current == Feed.ALL && ownFeed) || current == Feed.LIBRARY- val showForYou = (current == Feed.ALL && ownFeed) || current == Feed.FOR_YOU+ val showOwn = current == Feed.ALL && ownFeed+ val showReleases = showOwn+ val showArtists = showOwn+ val showLibrary = showOwn+ val showForYou = showOwnval filter = currentLazyColumn(@@ -372,9 +387,10 @@ fun HomeScreen(// API round trip a second or two behind, and without a// placeholder the page arrived in two halves and shifted under// whatever was being read.- if (filter == Feed.ALL) {- val allShelves = if (mixShelves.isEmpty()) shelves else (shelves + mixShelves).distinctBy { it.title }- allShelves.forEach { shelf ->+ run {+ val visible = if (filter == Feed.ALL) shelves+ else shelves.filter { dev.lelonio.square.data.TabContents.chipOf(it) == filter.chip }+ visible.forEach { shelf ->item(contentType = "shelf") { Heading(shelf.title) }item(contentType = "shelf") {Carousel(shelf.items, key = { it.uri }) { entry ->@@ -414,9 +430,9 @@ fun HomeScreen(}}- if (showLibrary || (filter == Feed.ALL && shelves.isEmpty())) {- item(contentType = Feed.LIBRARY.name) { Heading(stringResource(R.string.your_playlists)) }- item(contentType = Feed.LIBRARY.name) {+ if (showLibrary) {+ item(contentType = "library") { Heading(stringResource(R.string.your_playlists)) }+ item(contentType = "library") {Carousel(playlists.take(if (showLibrary) LIBRARY_SIZE else CAROUSEL_SIZE),key = { it.uri },@@ -433,7 +449,7 @@ fun HomeScreen(}if (showReleases && feed.newReleases.isNotEmpty()) {- item(contentType = Feed.RELEASES.name) { Heading(stringResource(R.string.feed_releases)) }+ item(contentType = "releases") { Heading(stringResource(R.string.feed_releases)) }// Cards rather than another row of thumbnails. A carousel// says "here is a list, pick one"; this is meant to be// looked at, so each release gets the width of the page and@@ -441,7 +457,7 @@ fun HomeScreen(items(feed.newReleases.take(FEED_SIZE),key = { it.uri },- contentType = { Feed.RELEASES.name },+ contentType = { "releases" },) { item ->FeedCard(item) { onOpenItem(item) }}@@ -495,9 +511,9 @@ fun HomeScreen(}}- if (recent.isNotEmpty() && filter != Feed.ARTISTS) {- item(contentType = Feed.LIBRARY.name) { Heading(stringResource(R.string.play_again)) }- item(contentType = Feed.LIBRARY.name) {+ if (recent.isNotEmpty() && filter == Feed.ALL) {+ item(contentType = "library") { Heading(stringResource(R.string.play_again)) }+ item(contentType = "library") {LazyRow(contentPadding = PaddingValues(horizontal = 20.dp),horizontalArrangement = Arrangement.spacedBy(12.dp),@@ -562,6 +578,7 @@ private fun Header(backdrop: Backdrop,topPadding: Dp,onFilter: (Feed) -> Unit,+ chips: List<Feed> = Feed.entries.toList(),onOpenSettings: () -> Unit,/** Who the account follows and what they play; empty hides the control. */friends: List<dev.lelonio.square.data.FriendListen> = emptyList(),@@ -718,18 +735,18 @@ private fun Header(// The chips carry the header's bottom margin with them; without them// the list would start against the app's own name.- if (showFilters) FilterRow(highlighted, backdrop, onFilter) else Spacer(Modifier.height(16.dp))+ if (showFilters) FilterRow(highlighted, chips, backdrop, onFilter) else Spacer(Modifier.height(16.dp))}}@Composable-private fun FilterRow(selected: Feed, backdrop: Backdrop, onSelect: (Feed) -> Unit) {+private fun FilterRow(selected: Feed, chips: List<Feed>, backdrop: Backdrop, onSelect: (Feed) -> Unit) {LazyRow(contentPadding = PaddingValues(horizontal = 20.dp),horizontalArrangement = Arrangement.spacedBy(8.dp),modifier = Modifier.padding(top = 14.dp, bottom = 10.dp),) {- items(Feed.entries.toList(), key = { it.name }) { entry ->+ items(chips, key = { it.name }) { entry ->dev.lelonio.square.ui.components.FilterChip(label = stringResource(entry.label),selected = entry == selected,diff --git a/app/src/main/java/dev/lelonio/square/ui/library/PlaylistScreen.kt b/app/src/main/java/dev/lelonio/square/ui/library/PlaylistScreen.ktindex 0404d71..2f992eb 100644--- a/app/src/main/java/dev/lelonio/square/ui/library/PlaylistScreen.kt+++ b/app/src/main/java/dev/lelonio/square/ui/library/PlaylistScreen.kt@@ -913,6 +913,20 @@ fun PlaylistScreen(}}+ // Lists like this one, once every song is in: under a list still+ // filling in, the row would land between its songs.+ if (!isArtist && state.relatedPlaylists.isNotEmpty() && query.isBlank() &&+ !state.loadingMore+ ) {+ item(contentType = "relatedPlaylists") {+ AlbumStrip(+ albums = state.relatedPlaylists,+ title = stringResource(R.string.related_playlists),+ onOpen = onOpenItem,+ )+ }+ }+// Everything the artist is in, under the songs they are known for.//// The tracks come first because that is what an artist page isdiff --git a/app/src/main/java/dev/lelonio/square/ui/player/FullScreenVideo.kt b/app/src/main/java/dev/lelonio/square/ui/player/FullScreenVideo.ktindex aeead97..5d5c081 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/FullScreenVideo.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/FullScreenVideo.kt@@ -20,7 +20,6 @@ import androidx.compose.runtime.Composableimport androidx.compose.runtime.DisposableEffectimport androidx.compose.runtime.Stateimport androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableFloatStateOfimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberimport androidx.compose.runtime.setValue@@ -34,7 +33,6 @@ import androidx.compose.foundation.layout.heightimport dev.lelonio.square.ui.glass.backdrop.backdrops.layerBackdropimport dev.lelonio.square.ui.glass.backdrop.backdrops.rememberLayerBackdropimport androidx.media3.common.Player-import androidx.media3.common.VideoSizeimport com.adamglin.PhosphorIconsimport com.adamglin.phosphoricons.Fillimport com.adamglin.phosphoricons.fill.Pause@@ -68,21 +66,9 @@ fun FullScreenVideo(onToggleShuffle: () -> Unit,onCycleRepeat: () -> Unit,) {- // The video's own shape, so it is fitted rather than stretched. A default- // until the first frame reports one: the alternative is a black screen- // that jumps as soon as the decoder speaks.- var ratio by remember { mutableFloatStateOf(16f / 9f) }- DisposableEffect(player) {- val listener = object : Player.Listener {- override fun onVideoSizeChanged(size: VideoSize) {- if (size.width > 0 && size.height > 0) {- ratio = size.width * size.pixelWidthHeightRatio / size.height- }- }- }- player.addListener(listener)- onDispose { player.removeListener(listener) }- }+ // The video's own shape, so it is fitted rather than stretched; see+ // rememberVideoRatio.+ val ratio = rememberVideoRatio(player, attachKey)var showControls by remember { mutableStateOf(true) }@@ -141,7 +127,7 @@ fun FullScreenVideo(.layerBackdrop(backdrop),)- VideoSurface(player, attachKey, Modifier.fillMaxWidth().aspectRatio(ratio))+ VideoSurface(player, attachKey, Modifier.aspectRatio(ratio))// A wash over the picture while the controls are up, so white text and// white glass have something to sit on. It goes with them.diff --git a/app/src/main/java/dev/lelonio/square/ui/player/PlayerPanel.kt b/app/src/main/java/dev/lelonio/square/ui/player/PlayerPanel.ktindex 2bc9c61..fb8e24f 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/PlayerPanel.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/PlayerPanel.kt@@ -148,7 +148,7 @@ fun PlayerPanelSection(backdrop = backdrop,tabsCount = views.size,accentColor = GlassInk,- containerColor = PlayerFilm,+ containerColor = LocalPlayerFilm.current,// Slimmer than the tab bar, and icon-only. This one sits under the// transport rather than at the edge of the window, so it has to// read as a smaller thing than the app's own navigation.diff --git a/app/src/main/java/dev/lelonio/square/ui/player/PlayerScreen.kt b/app/src/main/java/dev/lelonio/square/ui/player/PlayerScreen.ktindex 82d6db1..a5b6157 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/PlayerScreen.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/PlayerScreen.kt@@ -74,6 +74,7 @@ import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.Shadowimport androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.graphics.toArgbimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.text.TextLayoutResult@@ -82,6 +83,7 @@ import androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dpimport androidx.media3.common.Player+import androidx.media3.common.VideoSizeimport androidx.media3.common.util.UnstableApiimport coil.compose.AsyncImageimport androidx.lifecycle.compose.collectAsStateWithLifecycle@@ -114,7 +116,6 @@ import com.adamglin.phosphoricons.fill.SkipBackimport com.adamglin.phosphoricons.fill.SkipForwardimport com.adamglin.phosphoricons.regular.CaretDownimport com.adamglin.phosphoricons.regular.Devices-import com.adamglin.phosphoricons.regular.DotsThreeimport com.adamglin.phosphoricons.regular.Heartimport com.adamglin.phosphoricons.regular.Plusimport com.adamglin.phosphoricons.regular.Queue@@ -351,8 +352,6 @@ fun PlayerScreen(connectAvailable: Boolean = true,/** Whether the sound is coming out of another of the account's devices. */onAnotherDevice: Boolean = false,- /** Opens the contextual menu sheet for the current track ("…"). */- onMore: (() -> Unit)? = null,) {var panel by remember { mutableStateOf(PlayerPanel.NONE) }@@ -770,7 +769,6 @@ fun PlayerScreen(onAnotherDevice = onAnotherDevice,onWatchVideo = onWatchVideo,videoOn = videoOn,- onMore = onMore,)// Everything sits at the bottom, as in the reference: the@@ -1071,7 +1069,7 @@ fun PlayerScreen() {GlassSurface(backdrop = glassBackdrop,- surfaceColor = PlayerFilm,+ surfaceColor = LocalPlayerFilm.current,shape = RoundedCornerShape(50),// The gap to the title lives here rather than// in a spacer beside it: what a visibility@@ -1112,7 +1110,7 @@ fun PlayerScreen(// per-track actions on the right.GlassSurface(backdrop = glassBackdrop,- surfaceColor = PlayerFilm,+ surfaceColor = LocalPlayerFilm.current,shape = RoundedCornerShape(50),modifier = Modifier.fillMaxWidth()@@ -1301,13 +1299,17 @@ private fun VideoStage(protectedContent: Boolean,onAmbient: (AmbientEdges) -> Unit,) {+ // The video's own shape, fitted inside the stage. A fixed 16:9 box drew+ // every other shape stretched to it: a wide film pulled tall, a square+ // clip pulled wide.+ val ratio = rememberVideoRatio(player, attachKey)+if (protectedContent) {VideoSurface(player,attachKey,Modifier- .fillMaxWidth()- .aspectRatio(16f / 9f)+ .aspectRatio(ratio).clip(RoundedCornerShape(18.dp)),)PanelAmbient(player, onAmbient)@@ -1348,8 +1350,7 @@ private fun VideoStage(androidx.compose.ui.viewinterop.AndroidView(factory = { texture },modifier = Modifier- .fillMaxWidth()- .aspectRatio(16f / 9f)+ .aspectRatio(ratio).clip(RoundedCornerShape(18.dp)),)}@@ -1512,6 +1513,43 @@ private fun PanelAmbient(player: Player, onAmbient: (AmbientEdges) -> Unit) {}}+/**+ * The video's own shape, width over height, as the player reports it.+ *+ * Read off the player on the way in as well as listened for. The size is+ * announced once, when the picture starts, so a screen opened on a video that+ * was already playing (turning the phone on its side, which is the usual way+ * in) never heard it and kept its guess. 16:9 until anything is known, which+ * is what most of them are.+ *+ * Give it to `aspectRatio` with no fill in front: inside a box that leaves the+ * size open, that fits the picture to whichever side runs out first. Asked to+ * fill the width as well, a picture narrower than the screen could not be both,+ * and the surface stretched it over the whole display instead.+ */+@Composable+internal fun rememberVideoRatio(player: Player, attachKey: Any? = null): Float {+ var ratio by remember(player, attachKey) {+ mutableFloatStateOf(player.videoSize.ratio() ?: DEFAULT_VIDEO_RATIO)+ }+ DisposableEffect(player, attachKey) {+ player.videoSize.ratio()?.let { ratio = it }+ val listener = object : Player.Listener {+ override fun onVideoSizeChanged(videoSize: VideoSize) {+ videoSize.ratio()?.let { ratio = it }+ }+ }+ player.addListener(listener)+ onDispose { player.removeListener(listener) }+ }+ return ratio+}++private fun VideoSize.ratio(): Float? =+ if (width > 0 && height > 0) width * pixelWidthHeightRatio / height else null++private const val DEFAULT_VIDEO_RATIO = 16f / 9f+/** The surface itself, shared with the floating window; see [VideoStage]. */@Composablefun VideoSurface(player: Player, attachKey: Any? = null, modifier: Modifier = Modifier) {@@ -1528,7 +1566,7 @@ fun VideoSurface(player: Player, attachKey: Any? = null, modifier: Modifier = Moprivate fun TopBar(backdrop: Backdrop,panel: PlayerPanel,- /** Where the queue came from: "Playlist · Estate 2025", "Ricerca". */+ /** Where the queue came from: "Estate 2025", "Ricerca". */source: String,/** Opens that place, when it is one; null leaves the line as a caption. */onOpenSource: (() -> Unit)?,@@ -1539,7 +1577,6 @@ private fun TopBar(/** Null when the track has no video to watch. */onWatchVideo: (() -> Unit)?,videoOn: Boolean,- onMore: (() -> Unit)? = null,) {Row(Modifier@@ -1637,16 +1674,6 @@ private fun TopBar()}}- if (onMore != null) {- Spacer(Modifier.size(8.dp))- GlassButton(backdrop, onClick = onMore) {- Icon(- PhosphorIcons.Regular.DotsThree,- contentDescription = stringResource(R.string.more),- tint = GlassInk,- )- }- }}}@@ -2108,7 +2135,7 @@ internal val GlassFilm: Color}/**- * The film on the player's own glass, which is always the dark one.+ * The dark film, for a record with no colour of its own yet.** The same tint the glass recipe puts under light ink, at the same strength,* so the panes that draw their film themselves match the ones that get it from@@ -2117,6 +2144,34 @@ internal val GlassFilm: Color*/internal val PlayerFilm = Color(0xFF23232A).copy(alpha = 0.5f)+/**+ * The film the player's glass is made of while a record plays.+ *+ * Provided once, over the whole player, so the panes that draw their own film+ * stay the material of the ones that get it from [GlassEffect]; SquareApp+ * hands the same colour to both.+ */+internal val LocalPlayerFilm = androidx.compose.runtime.compositionLocalOf { PlayerFilm }++/**+ * The record's colour at the depth of the dark film.+ *+ * Its hue, with the saturation held back so a loud sleeve gives tinted glass+ * rather than a coloured slab, and the darkness the light ink was chosen+ * against, so the writing reads on it as it did on the grey. A grey record+ * gives very nearly the film it always had.+ */+internal fun playerFilmTint(accent: Color): Color {+ val hsv = FloatArray(3)+ android.graphics.Color.colorToHSV(accent.toArgb(), hsv)+ hsv[1] = hsv[1].coerceAtMost(FILM_SATURATION)+ hsv[2] = FILM_VALUE+ return Color(android.graphics.Color.HSVToColor(hsv))+}++private const val FILM_SATURATION = 0.55f+private const val FILM_VALUE = 0.24f+/*** The lyrics, centre stage.*diff --git a/app/src/main/java/dev/lelonio/square/ui/search/SearchScreen.kt b/app/src/main/java/dev/lelonio/square/ui/search/SearchScreen.ktindex 3716259..be28b19 100644--- a/app/src/main/java/dev/lelonio/square/ui/search/SearchScreen.kt+++ b/app/src/main/java/dev/lelonio/square/ui/search/SearchScreen.kt@@ -93,6 +93,8 @@ fun SearchScreen(*/history: List<dev.lelonio.square.data.SearchHistoryEntry>,onClearHistory: () -> Unit,+ /** One of them out of the history, dragged off to the right. */+ onRemoveHistory: (String) -> Unit,/** No connection: the catalogue cannot be searched at all. */offline: Boolean = false,onEnqueue: (CatalogTrack) -> Unit,@@ -196,7 +198,10 @@ fun SearchScreen(val at = remember(history, entry.uri) {songs.indexOfFirst { it.uri == entry.uri }.coerceAtLeast(0)}- SwipeToQueue(onQueue = { onEnqueue(track) }) {+ SwipeToQueue(+ onQueue = { onEnqueue(track) },+ onRemove = { onRemoveHistory(entry.uri) },+ ) {ResultRow(title = track.name,subtitle = track.artist,@@ -209,27 +214,33 @@ fun SearchScreen(}} else {// An artist, a record or a list: the row opens its page,- // which is what it did when it was found.- ResultRow(- title = entry.title,- subtitle = entry.subtitle,- artworkUrl = entry.artworkUrl,- highlighted = false,- // Only an artist is drawn round, and an artist is the- // one kind whose address says so.- round = entry.uri.contains(":artist:"),- onClick = {- onOpenContext(- SearchItem(- uri = entry.uri,- title = entry.title,- subtitle = entry.subtitle,- artworkUrl = entry.artworkUrl,- ),- )- },- onMenu = null,- )+ // which is what it did when it was found. Nothing to+ // queue, so it only goes one way.+ SwipeToQueue(+ onQueue = null,+ onRemove = { onRemoveHistory(entry.uri) },+ ) {+ ResultRow(+ title = entry.title,+ subtitle = entry.subtitle,+ artworkUrl = entry.artworkUrl,+ highlighted = false,+ // Only an artist is drawn round, and an artist is+ // the one kind whose address says so.+ round = entry.uri.contains(":artist:"),+ onClick = {+ onOpenContext(+ SearchItem(+ uri = entry.uri,+ title = entry.title,+ subtitle = entry.subtitle,+ artworkUrl = entry.artworkUrl,+ ),+ )+ },+ onMenu = null,+ )+ }}}// The page on its way, said in the one place the reader is@@ -387,7 +398,7 @@ private fun HistoryTitle(onClear: () -> Unit) {modifier = Modifier.weight(1f),)Text(- stringResource(R.string.clear),+ stringResource(R.string.clear_history),style = MaterialTheme.typography.labelLarge,color = InkDim,modifier = Modifierdiff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xmlindex 8ebc10b..20eeb5d 100644--- a/app/src/main/res/values-de/strings.xml+++ b/app/src/main/res/values-de/strings.xml@@ -8,6 +8,7 @@<string name="cancel">Abbrechen</string><string name="save">Speichern</string><string name="clear">Löschen</string>+ <string name="clear_history">Leeren</string><string name="credits">Credits</string><string name="karaoke">Karaoke</string><string name="translation">Übersetzung</string>@@ -70,6 +71,7 @@<string name="good_evening">Guten Abend</string><string name="feed_all">Alles</string><string name="feed_for_you">Für dich</string>+ <string name="feed_discover">Entdecken</string><string name="feed_releases">Neu</string><string name="your_playlists">Deine Playlists</string><string name="listening_artists">Künstler, die du hörst</string>@@ -166,6 +168,7 @@<string name="add_to_library">Zur Bibliothek hinzufügen</string><string name="remove_from_library">Aus der Bibliothek entfernen</string><string name="artist_playlists">Playlists mit diesem Künstler</string>+ <string name="related_playlists">Ähnliche Playlists</string><string name="singles_and_eps">Singles und EPs</string><string name="appears_on">Mit dabei auf</string><string name="followers_count">%1$s Follower</string>diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xmlindex 6a8f3c2..85c6950 100644--- a/app/src/main/res/values-es/strings.xml+++ b/app/src/main/res/values-es/strings.xml@@ -8,6 +8,7 @@<string name="cancel">Cancelar</string><string name="save">Guardar</string><string name="clear">Borrar</string>+ <string name="clear_history">Vaciar</string><string name="credits">Créditos</string><string name="karaoke">Karaoke</string><string name="translation">Traducción</string>@@ -70,6 +71,7 @@<string name="good_evening">Buenas noches</string><string name="feed_all">Todo</string><string name="feed_for_you">Para ti</string>+ <string name="feed_discover">Descubrir</string><string name="feed_releases">Novedades</string><string name="your_playlists">Tus playlists</string><string name="listening_artists">Artistas que escuchas</string>@@ -166,6 +168,7 @@<string name="add_to_library">Añadir a la biblioteca</string><string name="remove_from_library">Quitar de la biblioteca</string><string name="artist_playlists">Listas con este artista</string>+ <string name="related_playlists">Listas similares</string><string name="singles_and_eps">Sencillos y EP</string><string name="appears_on">Aparece en</string><string name="followers_count">%1$s seguidores</string>diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xmlindex 6d6ee0a..2cb030d 100644--- a/app/src/main/res/values-fr/strings.xml+++ b/app/src/main/res/values-fr/strings.xml@@ -8,6 +8,7 @@<string name="cancel">Annuler</string><string name="save">Enregistrer</string><string name="clear">Effacer</string>+ <string name="clear_history">Vider</string><string name="credits">Crédits</string><string name="karaoke">Karaoké</string><string name="translation">Traduction</string>@@ -70,6 +71,7 @@<string name="good_evening">Bonsoir</string><string name="feed_all">Tout</string><string name="feed_for_you">Pour vous</string>+ <string name="feed_discover">Découvrir</string><string name="feed_releases">Nouveautés</string><string name="your_playlists">Vos playlists</string><string name="listening_artists">Artistes que vous écoutez</string>@@ -166,6 +168,7 @@<string name="add_to_library">Ajouter à la bibliothèque</string><string name="remove_from_library">Retirer de la bibliothèque</string><string name="artist_playlists">Playlists avec cet artiste</string>+ <string name="related_playlists">Playlists similaires</string><string name="singles_and_eps">Singles et EP</string><string name="appears_on">Apparaît sur</string><string name="followers_count">%1$s abonnés</string>diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xmlindex 2884f76..8abd042 100644--- a/app/src/main/res/values-hi/strings.xml+++ b/app/src/main/res/values-hi/strings.xml@@ -13,6 +13,7 @@<string name="cancel">रद्द करें</string><string name="save">सहेजें</string><string name="clear">साफ़ करें</string>+ <string name="clear_history">सब हटाएँ</string><string name="credits">श्रेय</string><string name="karaoke">कराओके</string><string name="translation">अनुवाद</string>@@ -76,6 +77,7 @@<string name="good_evening">शुभ संध्या</string><string name="feed_all">सब कुछ</string><string name="feed_for_you">आपके लिए</string>+ <string name="feed_discover">खोजें</string><string name="feed_releases">नया</string><string name="your_playlists">आपकी प्लेलिस्ट</string><string name="listening_artists">जिन कलाकारों को आप सुनते हैं</string>@@ -178,6 +180,7 @@<string name="add_to_library">लाइब्रेरी में जोड़ें</string><string name="remove_from_library">लाइब्रेरी से हटाएँ</string><string name="artist_playlists">इस कलाकार की प्लेलिस्ट</string>+ <string name="related_playlists">मिलती-जुलती प्लेलिस्ट</string><string name="singles_and_eps">सिंगल और EP</string><string name="appears_on">इनमें शामिल</string><string name="followers_count">%1$s फ़ॉलोअर</string>diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xmlindex f9321a2..9f0c4fe 100644--- a/app/src/main/res/values-it/strings.xml+++ b/app/src/main/res/values-it/strings.xml@@ -9,6 +9,7 @@<string name="cancel">Annulla</string><string name="save">Salva</string><string name="clear">Cancella</string>+ <string name="clear_history">Svuota</string><string name="credits">Crediti</string><string name="karaoke">Karaoke</string><string name="translation">Traduzione</string>@@ -71,6 +72,7 @@<string name="good_evening">Buonasera</string><string name="feed_all">Tutto</string><string name="feed_for_you">Per te</string>+ <string name="feed_discover">Scopri</string><string name="feed_releases">Novità</string><string name="your_playlists">Le tue playlist</string><string name="listening_artists">Artisti che ascolti</string>@@ -167,6 +169,7 @@<string name="add_to_library">Aggiungi alla libreria</string><string name="remove_from_library">Togli dalla libreria</string><string name="artist_playlists">Playlist con questo artista</string>+ <string name="related_playlists">Playlist simili</string><string name="singles_and_eps">Singoli ed EP</string><string name="appears_on">Compare in</string><string name="followers_count">%1$s follower</string>diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xmlindex b08f124..237d750 100644--- a/app/src/main/res/values-pt/strings.xml+++ b/app/src/main/res/values-pt/strings.xml@@ -8,6 +8,7 @@<string name="cancel">Cancelar</string><string name="save">Salvar</string><string name="clear">Limpar</string>+ <string name="clear_history">Limpar tudo</string><string name="credits">Créditos</string><string name="karaoke">Karaoke</string><string name="translation">Tradução</string>@@ -70,6 +71,7 @@<string name="good_evening">Boa noite</string><string name="feed_all">Tudo</string><string name="feed_for_you">Para você</string>+ <string name="feed_discover">Descobrir</string><string name="feed_releases">Novidades</string><string name="your_playlists">Suas playlists</string><string name="listening_artists">Artistas que você ouve</string>@@ -166,6 +168,7 @@<string name="add_to_library">Adicionar à biblioteca</string><string name="remove_from_library">Remover da biblioteca</string><string name="artist_playlists">Playlists com este artista</string>+ <string name="related_playlists">Playlists parecidas</string><string name="singles_and_eps">Singles e EP</string><string name="appears_on">Aparece em</string><string name="followers_count">%1$s seguidores</string>diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xmlindex dd60d10..852d229 100644--- a/app/src/main/res/values-tr/strings.xml+++ b/app/src/main/res/values-tr/strings.xml@@ -13,6 +13,7 @@<string name="cancel">Vazgeç</string><string name="save">Kaydet</string><string name="clear">Temizle</string>+ <string name="clear_history">Tümünü temizle</string><string name="credits">Katkıda bulunanlar</string><string name="karaoke">Karaoke</string><string name="translation">Çeviri</string>@@ -76,6 +77,7 @@<string name="good_evening">İyi akşamlar</string><string name="feed_all">Hepsi</string><string name="feed_for_you">Sana özel</string>+ <string name="feed_discover">Keşfet</string><string name="feed_releases">Yeni</string><string name="your_playlists">Çalma listelerin</string><string name="listening_artists">Dinlediğin sanatçılar</string>@@ -178,6 +180,7 @@<string name="add_to_library">Kitaplığa ekle</string><string name="remove_from_library">Kitaplıktan kaldır</string><string name="artist_playlists">Bu sanatçının çalma listeleri</string>+ <string name="related_playlists">Benzer çalma listeleri</string><string name="singles_and_eps">Single ve EP</string><string name="appears_on">Yer aldığı albümler</string><string name="followers_count">%1$s takipçi</string>diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex f028300..3d2f3df 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -19,6 +19,7 @@<string name="cancel">Cancel</string><string name="save">Save</string><string name="clear">Clear</string>+ <string name="clear_history">Clear all</string><string name="credits">Credits</string><string name="karaoke">Karaoke</string><string name="translation">Translation</string>@@ -82,6 +83,7 @@<string name="good_evening">Good evening</string><string name="feed_all">Everything</string><string name="feed_for_you">For you</string>+ <string name="feed_discover">Discover</string><string name="feed_releases">New</string><string name="your_playlists">Your playlists</string><string name="listening_artists">Artists you listen to</string>@@ -184,6 +186,7 @@<string name="add_to_library">Add to library</string><string name="remove_from_library">Remove from library</string><string name="artist_playlists">Playlists with this artist</string>+ <string name="related_playlists">Similar playlists</string><string name="singles_and_eps">Singles and EPs</string><string name="appears_on">Appears on</string><string name="followers_count">%1$s followers</string>diff --git a/pathfinder.json b/pathfinder.jsonindex 95cdaab..2cbddbb 100644--- a/pathfinder.json+++ b/pathfinder.json@@ -5,5 +5,7 @@"playlist": "86dde7b9d9356e2369414647cf6950cfed96e778e129cfdfc99aea6c1613b3b0","library": "134337999233cc6fdd6b1e6dbf94841409f04a946c5c7b744b09ba0dfe5a85ed","search": "db61238974d27839a136c9dc02bfdbe3fab7635f21cf85976ebff9a1ee281345",+ "artistOverview": "9f8134ef565e78621f1e1793555bd6633c5ac144ae0f89604ed3ae3f80b3c8e6",+ "playlistSection": "2615df403a9043c1d7d3094fbeb4c9653b07b11a33d8081fbd31f0f7959ff4a1","appVersion": "1.2.97.155.g5dd0dcaf-development"}