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
Neutral pages, a Canvas that ends, and search that goes on
Lelonioa08d90bb688c
diff --git a/app/src/main/java/dev/lelonio/square/backend/MusicBackend.kt b/app/src/main/java/dev/lelonio/square/backend/MusicBackend.ktindex 89582c3..3bcf6bc 100644--- a/app/src/main/java/dev/lelonio/square/backend/MusicBackend.kt+++ b/app/src/main/java/dev/lelonio/square/backend/MusicBackend.kt@@ -98,7 +98,7 @@ interface MusicBackend {suspend fun refreshAuth()suspend fun logOut()- suspend fun search(query: String, labels: SearchLabels): SearchResults+ suspend fun search(query: String, labels: SearchLabels, offset: Int = 0): SearchResults/*** Whether the last search had nowhere to go.diff --git a/app/src/main/java/dev/lelonio/square/backend/SpotifyBackend.kt b/app/src/main/java/dev/lelonio/square/backend/SpotifyBackend.ktindex 4bc30d6..d6feceb 100644--- a/app/src/main/java/dev/lelonio/square/backend/SpotifyBackend.kt+++ b/app/src/main/java/dev/lelonio/square/backend/SpotifyBackend.kt@@ -82,9 +82,13 @@ class SpotifyBackend(private val container: SquareApplication) : MusicBackend {* client. So the registered application stays as the fallback, and a search* only fails when both have nothing; see [dev.lelonio.square.data.Gateway].*/- override suspend fun search(query: String, labels: SearchLabels): SearchResults {+ override suspend fun search(+ query: String,+ labels: SearchLabels,+ offset: Int,+ ): SearchResults {val term = query.trim()- container.gateway.search(term)+ container.gateway.search(term, offset)?.let { dev.lelonio.square.data.GatewaySearch.parse(it, labels) }?.let {searchNeedsSetup = false@@ -96,7 +100,7 @@ class SpotifyBackend(private val container: SquareApplication) : MusicBackend {return SearchResults()}searchNeedsSetup = false- return container.api.search(term).toResults(+ return container.api.search(term, offset = offset).toResults(artistLabel = labels.artist,albumLabel = labels.album,playlistLabel = labels.playlist,diff --git a/app/src/main/java/dev/lelonio/square/backend/youtube/YouTubeBackend.kt b/app/src/main/java/dev/lelonio/square/backend/youtube/YouTubeBackend.ktindex e18cbe4..7303690 100644--- a/app/src/main/java/dev/lelonio/square/backend/youtube/YouTubeBackend.kt+++ b/app/src/main/java/dev/lelonio/square/backend/youtube/YouTubeBackend.kt@@ -82,8 +82,17 @@ class YouTubeBackend(private val account: YouTubeAccount) : MusicBackend {* serially this is the slowest thing on the screen, and they do not depend* on each other.*/- override suspend fun search(query: String, labels: SearchLabels): SearchResults =+ override suspend fun search(+ query: String,+ labels: SearchLabels,+ offset: Int,+ ): SearchResults =withContext(Dispatchers.IO) {+ // One page only. YouTube's search is a continuation token rather+ // than an offset, and asking for a second page means keeping that+ // token — worth doing when this backend's search is the one being+ // used, and not worth pretending to do from here.+ if (offset > 0) return@withContext SearchResults()val trimmed = query.trim()coroutineScope {diff --git a/app/src/main/java/dev/lelonio/square/data/Gateway.kt b/app/src/main/java/dev/lelonio/square/data/Gateway.ktindex d6530b1..a30c652 100644--- a/app/src/main/java/dev/lelonio/square/data/Gateway.kt+++ b/app/src/main/java/dev/lelonio/square/data/Gateway.kt@@ -85,7 +85,7 @@ class Gateway(private val keys: PathfinderKeys) {* Null when the gateway will not answer, and the Web API is where the* caller goes then; see SpotifyBackend.*/- suspend fun search(term: String): String? {+ suspend fun search(term: String, offset: Int = 0): String? {if (term.isBlank()) return nullkeys.refresh()val quoted = org.json.JSONObject.quote(term)@@ -102,7 +102,7 @@ class Gateway(private val keys: PathfinderKeys) {// here. Ten and five is the web player's own page size, so an// hour of searching from this app reads like an hour of// searching from a browser tab.- variables = """{"searchTerm":$quoted,"offset":0,"limit":$SEARCH_LIMIT,""" ++ variables = """{"searchTerm":$quoted,"offset":$offset,"limit":$SEARCH_LIMIT,""" +""""numberOfTopResults":$TOP_RESULTS,"includeAudiobooks":true,""" +""""includeArtistHasConcertsField":false,"includePreReleases":true,""" +""""includeLocalConcertsField":false,"includeAlbumPreReleases":false,""" +diff --git a/app/src/main/java/dev/lelonio/square/data/SearchHistoryStore.kt b/app/src/main/java/dev/lelonio/square/data/SearchHistoryStore.ktindex f58dfb3..b0e6ca1 100644--- a/app/src/main/java/dev/lelonio/square/data/SearchHistoryStore.kt+++ b/app/src/main/java/dev/lelonio/square/data/SearchHistoryStore.kt@@ -7,16 +7,22 @@ import kotlinx.coroutines.flow.StateFlowimport kotlinx.coroutines.flow.asStateFlowimport kotlinx.coroutines.withContextimport kotlinx.serialization.builtins.ListSerializer+import kotlinx.serialization.Serializableimport kotlinx.serialization.json.Json/**- * What was found by searching and then played, kept locally.+ * What a search led to, kept locally.*- * Songs rather than the words typed to find them, which is the part worth- * keeping: half-typed terms and misspellings say nothing a week later, and the- * song they led to is the thing anyone actually wants back. It also means the- * list can be tapped — every row is a track, and playing it again is a tap- * rather than a search run a second time.+ * The thing found rather than the words typed to find it, which is the part+ * worth keeping: half-typed terms and misspellings say nothing a week later,+ * and what they led to is what anyone actually wants back. It also means the+ * list can be tapped — every row goes back where it came from.+ *+ * Everything a search can turn up, not only songs: an artist looked up on+ * Tuesday is exactly as worth having back as a song played on Tuesday, and the+ * list used to drop three quarters of what people searched for. A row that was+ * a song carries the song, so it can still be played from here; a row that was+ * an artist, a record or a list carries what is needed to open its page.** Local, like [RecentStore], and for the same reason: nothing is sent anywhere* and no quota is spent to keep it.@@ -27,38 +33,98 @@ class SearchHistoryStore(context: Context) {.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE)private val json = Json { ignoreUnknownKeys = true }- private val serializer = ListSerializer(CatalogTrack.serializer())+ private val serializer = ListSerializer(SearchHistoryEntry.serializer())+ private val legacy = ListSerializer(CatalogTrack.serializer())++ private val _entries = MutableStateFlow(load())+ val entries: StateFlow<List<SearchHistoryEntry>> = _entries.asStateFlow()- private val _tracks = MutableStateFlow(load())- val tracks: StateFlow<List<CatalogTrack>> = _tracks.asStateFlow()+ /** The songs among them, for the places that can only use songs. */+ val tracks: StateFlow<List<CatalogTrack>> = MutableStateFlow(+ _entries.value.mapNotNull { it.track },+ ).also { flow ->+ // Kept in step by the same writes: this store is small and written+ // rarely, so a derived flow costs less than every caller filtering.+ _tracksMirror = flow+ }.asStateFlow()/** Records a play, moving a repeat to the front rather than adding it twice. */suspend fun record(track: CatalogTrack) = withContext(Dispatchers.IO) {- save((listOf(track) + _tracks.value.filterNot { it.uri == track.uri }).take(LIMIT))+ record(+ SearchHistoryEntry(+ uri = track.uri,+ title = track.name,+ subtitle = track.artist,+ artworkUrl = track.artworkUrl,+ track = track,+ ),+ )}- /** Takes one song out, for a search somebody would rather not keep. */+ /** And the same for whatever else a search turns up. */+ suspend fun record(entry: SearchHistoryEntry) = withContext(Dispatchers.IO) {+ save((listOf(entry) + _entries.value.filterNot { it.uri == entry.uri }).take(LIMIT))+ }++ /** Takes one row out, for a search somebody would rather not keep. */suspend fun remove(uri: String) = withContext(Dispatchers.IO) {- save(_tracks.value.filterNot { it.uri == uri })+ save(_entries.value.filterNot { it.uri == uri })}suspend fun clear() = withContext(Dispatchers.IO) { save(emptyList()) }- private fun save(tracks: List<CatalogTrack>) {- _tracks.value = tracks- prefs.edit().putString(KEY_TRACKS, json.encodeToString(serializer, tracks)).apply()+ private fun save(entries: List<SearchHistoryEntry>) {+ _entries.value = entries+ _tracksMirror?.value = entries.mapNotNull { it.track }+ prefs.edit().putString(KEY_ENTRIES, json.encodeToString(serializer, entries)).apply()}- private fun load(): List<CatalogTrack> {+ private fun load(): List<SearchHistoryEntry> {+ prefs.getString(KEY_ENTRIES, null)?.let { raw ->+ return runCatching { json.decodeFromString(serializer, raw) }.getOrDefault(emptyList())+ }+ // What earlier versions kept, which was songs and nothing else.val raw = prefs.getString(KEY_TRACKS, null) ?: return emptyList()- return runCatching { json.decodeFromString(serializer, raw) }.getOrDefault(emptyList())+ return runCatching { json.decodeFromString(legacy, raw) }+ .getOrDefault(emptyList())+ .map {+ SearchHistoryEntry(+ uri = it.uri,+ title = it.name,+ subtitle = it.artist,+ artworkUrl = it.artworkUrl,+ track = it,+ )+ }}+ private var _tracksMirror: MutableStateFlow<List<CatalogTrack>>? = null+private companion object {const val FILE_NAME = "square_search_history"const val KEY_TRACKS = "tracks"+ const val KEY_ENTRIES = "entries"/** A screenful and a half; older than that and it is a different day. */const val LIMIT = 20}}++/**+ * One thing a search led to.+ *+ * [track] is filled only for a song, and it is what lets the row be played+ * from the list rather than merely opened; everything else carries the little+ * a row needs to be drawn and a page to be opened from it.+ */+@Serializable+data class SearchHistoryEntry(+ val uri: String,+ val title: String,+ val subtitle: String = "",+ val artworkUrl: String? = null,+ val track: CatalogTrack? = null,+) {+ /** Whether opening this means opening a page rather than playing a song. */+ val isContext: Boolean get() = track == null+}diff --git a/app/src/main/java/dev/lelonio/square/data/SearchResults.kt b/app/src/main/java/dev/lelonio/square/data/SearchResults.ktindex 4dda6b2..85cf5bd 100644--- a/app/src/main/java/dev/lelonio/square/data/SearchResults.kt+++ b/app/src/main/java/dev/lelonio/square/data/SearchResults.kt@@ -23,6 +23,31 @@ data class SearchResults(*/val lyricMatches: Set<String> = emptySet(),) {+ /** How many rows this holds in total, for telling a page from an echo. */+ val count: Int+ get() = tracks.size + artists.size + albums.size + playlists.size++ /**+ * This, with another page's rows after it.+ *+ * De-duplicated by address in every kind: an offset is the server's idea of+ * where a page starts, and a catalogue that has changed under it hands back+ * rows that are already on the screen.+ */+ operator fun plus(page: SearchResults): SearchResults {+ val heldTracks = tracks.mapTo(mutableSetOf()) { it.uri }+ val heldArtists = artists.mapTo(mutableSetOf()) { it.uri }+ val heldAlbums = albums.mapTo(mutableSetOf()) { it.uri }+ val heldLists = playlists.mapTo(mutableSetOf()) { it.uri }+ return SearchResults(+ tracks = tracks + page.tracks.filter { it.uri !in heldTracks },+ artists = artists + page.artists.filter { it.uri !in heldArtists },+ albums = albums + page.albums.filter { it.uri !in heldAlbums },+ playlists = playlists + page.playlists.filter { it.uri !in heldLists },+ lyricMatches = lyricMatches + page.lyricMatches,+ )+ }+val isEmpty: Booleanget() = tracks.isEmpty() && artists.isEmpty() && albums.isEmpty() && playlists.isEmpty()}diff --git a/app/src/main/java/dev/lelonio/square/data/SpotifyApi.kt b/app/src/main/java/dev/lelonio/square/data/SpotifyApi.ktindex 4a2bf1f..ad3bfa0 100644--- a/app/src/main/java/dev/lelonio/square/data/SpotifyApi.kt+++ b/app/src/main/java/dev/lelonio/square/data/SpotifyApi.kt@@ -345,6 +345,8 @@ interface SpotifyApi {@Query("type") type: String = "track,album,artist,playlist",/** Fifty is this endpoint's maximum, and the fallback should not be thinner. */@Query("limit") limit: Int = 40,+ /** Where the page starts, for a second helping of the same search. */+ @Query("offset") offset: Int = 0,): SearchDto}diff --git a/app/src/main/java/dev/lelonio/square/ui/MainViewModel.kt b/app/src/main/java/dev/lelonio/square/ui/MainViewModel.ktindex d2ceba4..a3e5f64 100644--- a/app/src/main/java/dev/lelonio/square/ui/MainViewModel.kt+++ b/app/src/main/java/dev/lelonio/square/ui/MainViewModel.kt@@ -1125,12 +1125,20 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {* application that used to be the only way in.*/val needsSetup: Boolean = false,+ /** A second helping of the same search, on its way. */+ val loadingMore: Boolean = false,+ /** Set once a page comes back with nothing new to add. */+ val exhausted: Boolean = false,)private val _search = MutableStateFlow(SearchState())val search: StateFlow<SearchState> = _search.asStateFlow()private var searchJob: Job? = null+ /** How far into the results the next page starts. */+ private var searchOffset = 0+ private var searchMoreJob: Job? = null+/*** Runs a search, debounced.*@@ -1142,6 +1150,9 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {_search.value = _search.value.copy(query = query)searchJob?.cancel()+ searchMoreJob?.cancel()+ searchOffset = 0+if (query.isBlank()) {_search.value = SearchState(query = query)return@@ -1165,10 +1176,13 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {// not shown: a slow search that was replaced while it ran// would otherwise land on top of the newer one.currentCoroutineContext().ensureActive()+ searchOffset = SEARCH_PAGE_search.value = _search.value.copy(loading = false,results = results,needsSetup = backend.searchNeedsSetup,+ loadingMore = false,+ exhausted = results.isEmpty,)}.onFailure {@@ -1184,6 +1198,59 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {}}+ /**+ * The next page of the same search, appended.+ *+ * Called by the list as it nears its end rather than by a button: twenty of+ * each kind is the web player's own page size and a fine first answer, but+ * a search for a name that a hundred records share stopped dead at twenty+ * with no way to see the rest.+ *+ * Appended rather than replaced, and de-duplicated by address: the offset+ * is the server's idea of where the page starts, and a catalogue that has+ * changed under it can hand back a row that is already on the screen.+ */+ fun loadMoreSearch() {+ val state = _search.value+ if (state.query.isBlank() || state.loading || state.loadingMore) return+ if (state.exhausted) return+ val backend = container.activeBackend+ searchMoreJob?.cancel()+ _search.value = state.copy(loadingMore = true)+ searchMoreJob = viewModelScope.launch {+ runCatching {+ backend.search(+ state.query,+ SearchLabels(+ artist = string(R.string.artist),+ album = string(R.string.album),+ playlist = string(R.string.playlist),+ ),+ offset = searchOffset,+ )+ }+ .onSuccess { page ->+ currentCoroutineContext().ensureActive()+ // Still the same search: a page that arrives after the box+ // has been retyped belongs to a question nobody is asking.+ if (_search.value.query != state.query) return@onSuccess+ val grown = _search.value.results.plus(page)+ val added = grown.count - _search.value.results.count+ searchOffset += SEARCH_PAGE+ _search.value = _search.value.copy(+ results = grown,+ loadingMore = false,+ exhausted = added == 0,+ )+ }+ .onFailure {+ if (it is kotlinx.coroutines.CancellationException) throw it+ android.util.Log.e(TAG, "search page failed: ${chain(it)}", it)+ _search.value = _search.value.copy(loadingMore = false, exhausted = true)+ }+ }+ }+/** The user's own Spotify application, used for search. */data class WebApiState(val clientId: String = "",@@ -1502,6 +1569,18 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {tracks.filter { container.activeBackend.owns(it.uri) }}.stateIn(viewModelScope, SharingStarted.Eagerly, emptyList())+ /**+ * Everything a search led to, newest first — songs, artists, records, lists.+ *+ * The list the search page draws. [searchHistory] is the songs among these,+ * for the places that can only use a song: the radio's seeds, and anything+ * that plays rather than opens.+ */+ val searchTrail: StateFlow<List<dev.lelonio.square.data.SearchHistoryEntry>> =+ combine(container.searchHistory.entries, container.preferences.backend) { entries, _ ->+ entries.filter { container.activeBackend.owns(it.uri) }+ }.stateIn(viewModelScope, SharingStarted.Eagerly, emptyList())+private val _credits =MutableStateFlow<dev.lelonio.square.backend.spotify.SpotifyCredits.Credits?>(null)@@ -1550,6 +1629,18 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {container.searchHistory.record(track)}+ /** And when a search result that is a page rather than a song is opened. */+ fun recordSearchOpen(item: dev.lelonio.square.data.SearchItem) = viewModelScope.launch {+ container.searchHistory.record(+ dev.lelonio.square.data.SearchHistoryEntry(+ uri = item.uri,+ title = item.title,+ subtitle = item.subtitle,+ artworkUrl = item.artworkUrl,+ ),+ )+ }+fun forgetSearchPlay(uri: String) = viewModelScope.launch {container.searchHistory.remove(uri)}@@ -4108,6 +4199,9 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {const val SEARCH_DEBOUNCE_MS = 350L+ /** How many of each kind a page of results holds; see Gateway. */+ const val SEARCH_PAGE = 20+/** Spotify acknowledges a transfer before it has taken effect. */const val TRANSFER_SETTLE_MS = 700L}diff --git a/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt b/app/src/main/java/dev/lelonio/square/ui/SquareApp.ktindex 8710e49..de246c4 100644--- a/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt+++ b/app/src/main/java/dev/lelonio/square/ui/SquareApp.kt@@ -139,6 +139,7 @@ import com.adamglin.phosphoricons.regular.Plusimport com.adamglin.phosphoricons.regular.Queueimport com.adamglin.phosphoricons.regular.SpotifyLogoimport com.adamglin.phosphoricons.regular.YoutubeLogo+import com.adamglin.phosphoricons.regular.Exportimport com.adamglin.phosphoricons.regular.Trashimport dev.lelonio.square.data.RemoteConnectimport dev.lelonio.square.ui.player.asPlaybackState@@ -162,6 +163,7 @@ import dev.lelonio.square.ui.theme.footToneForimport dev.lelonio.square.ui.theme.Inkimport dev.lelonio.square.ui.theme.pageColorForimport dev.lelonio.square.ui.theme.pageColorForHex+import dev.lelonio.square.ui.theme.pageGroundimport androidx.compose.animation.animateColorAsStateimport androidx.compose.animation.slideOutHorizontallyimport androidx.compose.animation.slideInHorizontally@@ -515,6 +517,7 @@ fun SquareApp(val recent by viewModel.recent.collectAsStateWithLifecycle()val search by viewModel.search.collectAsStateWithLifecycle()val searchHistory by viewModel.searchHistory.collectAsStateWithLifecycle()+ val searchTrail by viewModel.searchTrail.collectAsStateWithLifecycle()val webApi by viewModel.webApi.collectAsStateWithLifecycle()val reverb by AudioEffects.reverb.collectAsStateWithLifecycle()val presets by viewModel.effectPresets.collectAsStateWithLifecycle()@@ -693,6 +696,57 @@ fun SquareApp(val artBackdrop = rememberLayerBackdrop()val pageBackdrop = rememberLayerBackdrop()+ // The foot of the Canvas as it plays, which the player's field is made of+ // while there is one; see AmbientArtworkBackground.+ var clipColumns by remember { mutableStateOf<List<Color>>(emptyList()) }++ // What the player's field is made of, worked out once.+ //+ // Both the background and the player itself need it: one paints it, and the+ // other has to know whether what it is writing on is light or dark. It was+ // computed inside the background's own lambda, where the player could not+ // see it — and the player was choosing its ink from the phone's setting+ // instead, which is how a dark Canvas ended up with a near-black progress+ // bar drawn on it in the light setting.+ val ambientArt = nowPlayingArt?.heroUrl+ ?: nowPlayingArt?.coverUrl+ ?: playback.artworkUrl+ val ambientFoot by rememberArtworkFootColor(ambientArt)+ val ambientAccent by rememberArtworkColor(+ ambientArt.takeIf { nowPlayingArt?.bgColor == null },+ )+ val playerTone = when {+ nowPlayingArt?.bgColor != null ->+ pageColorForHex(nowPlayingArt?.bgColor, lift = false)+ ambientFoot != null -> footToneFor(ambientFoot, lift = false)+ else -> pageColorFor(ambientAccent)+ }++ // And the ink that field asks for.+ //+ // Damped a little first: the lower half of the player carries a black wash+ // for legibility, so the colour the transport actually sits on is darker+ // than the field's own — deciding on the undamped colour left dark ink on+ // a field that had since been taken down towards black.+ val playerInk = dev.lelonio.square.ui.theme.inkOn(+ androidx.compose.ui.graphics.lerp(+ if (clipColumns.isNotEmpty()) clipColumns.mean() else playerTone,+ Color.Black,+ 0.22f,+ ),+ )++ // Emptied by the track change itself, not by the answer about the new+ // track's Canvas.+ //+ // A song with no clip left the last one's colours on the screen: the reset+ // waited for the player to report that this track has no Canvas, and the+ // clip that was leaving went on sampling itself for the length of its own+ // crossfade — so whichever arrived last won, and it was usually the clip.+ // The track changing is the one moment that is certainly true.+ LaunchedEffect(playback.mediaId) { clipColumns = emptyList() }++// What the player's own glass refracts: the ambient field made from the// record, and nothing of the page underneath.//@@ -1299,12 +1353,7 @@ fun SquareApp(// them — instead of a duller colour off Spotify's// thumbnail, which is what made them look like a// different app's screens.- AppBackdrop(- artworkUrl = nowPlayingArt?.heroUrl- ?: nowPlayingArt?.coverUrl- ?: playback.artworkUrl,- tintHex = nowPlayingArt?.bgColor,- )+ AppBackdrop()}Box(@@ -1410,6 +1459,9 @@ fun SquareApp(onPlaySong = { tracks, index ->onPlay(tracks, index, null, false, newLabel, 0L)},+ onSongMenu = { track ->+ trackMenu = TrackMenuRequest(track = track, removable = false)+ },onOpen = { item ->viewModel.openContext(item.uri,@@ -1471,7 +1523,7 @@ fun SquareApp(tracks.getOrNull(index)?.let(viewModel::recordSearchPlay)onPlay(tracks, index, null, false, searchLabel, 0L)},- history = searchHistory,+ history = searchTrail,onClearHistory = viewModel::clearSearchHistory,offline = offlineNow,onEnqueue = onEnqueue,@@ -1484,9 +1536,14 @@ fun SquareApp()},onOpenContext = { item ->+ // Kept, like a song played from a result:+ // an artist looked up on Tuesday is worth+ // having back as much as a song is.+ viewModel.recordSearchOpen(item)viewModel.openContext(item.uri, item.title, item.artworkUrl)navController.navigate(Routes.PLAYLIST)},+ onLoadMore = viewModel::loadMoreSearch,backdrop = artBackdrop,)}@@ -1699,20 +1756,6 @@ fun SquareApp(onToggleFollow = viewModel::toggleFollowArtist,onToggleLatestSaved = viewModel::toggleLatestSaved,onToggleSaved = viewModel::toggleSaved,- onShare = {- val uri = playlist.uri ?: return@PlaylistScreen- context.startActivity(- android.content.Intent.createChooser(- android.content.Intent(android.content.Intent.ACTION_SEND)- .setType("text/plain")- .putExtra(- android.content.Intent.EXTRA_TEXT,- dev.lelonio.square.ui.library.openLinkOf(uri),- ),- null,- ),- )- },onMenu = {val uri = playlist.uri ?: return@PlaylistScreen// What the menu is allowed to offer, from@@ -1843,6 +1886,7 @@ fun SquareApp(FloatingMiniPlayer(state = playback,positionMs = positionMs,+ remoteLabel = remote?.let { remoteLabel },modifier = accessoryModifier.fillMaxWidth().then(pillGlass)@@ -2478,18 +2522,6 @@ fun SquareApp(// is the catalogue's where it gave one and the// picture's own where it did not, which is the same// rule every page in the app follows.- val ambientArt = nowPlayingArt?.heroUrl- ?: nowPlayingArt?.coverUrl- ?: playback.artworkUrl- // The band the fade actually meets, so the screen- // below the cover carries on from where the cover- // stopped rather than jumping to the colour that- // happens to identify the record. See- // rememberArtworkFootColor.- val ambientFoot by rememberArtworkFootColor(ambientArt)- val ambientAccent by rememberArtworkColor(- ambientArt.takeIf { nowPlayingArt?.bgColor == null },- )dev.lelonio.square.ui.components.AmbientArtworkBackground(artworkModel = ambientArt,// The shape the cover above is drawn at, so@@ -2502,13 +2534,7 @@ fun SquareApp(// behind the same cover. The colour read off// the picture is the fallback for the records// it has never heard of.- tone = when {- nowPlayingArt?.bgColor != null ->- pageColorForHex(nowPlayingArt?.bgColor, lift = false)- ambientFoot != null ->- footToneFor(ambientFoot, lift = false)- else -> pageColorFor(ambientAccent)- },+ tone = playerTone,// Barely any colour over the picture.//// The reference does not put a tone behind its@@ -2529,6 +2555,7 @@ fun SquareApp(// the app where an always-invalidating// background would be competing for the frame.motion = playerSettled,+ columns = clipColumns,)}},@@ -2541,6 +2568,12 @@ fun SquareApp(dev.lelonio.square.ui.player.LocalGlassEnabled provides(glassConfig.playerEnabled &&dev.lelonio.square.ui.player.LocalGlassEnabled.current),+ // Everything on this screen writes on the field,+ // and the field is the record — not the phone's+ // setting. The glass reads this too and takes the+ // opposite film; see GlassEffect.+ dev.lelonio.square.ui.theme.LocalInkOverride provides playerInk,+ androidx.compose.material3.LocalContentColor provides playerInk,) {PlayerScreen(state = playerState,@@ -2700,6 +2733,7 @@ fun SquareApp(// The colours filed with this artwork, for the// light that moves behind it; see CoverAura.catalogPalette = nowPlayingArt?.inkPalette.orEmpty(),+ onClipColumns = { clipColumns = it },coverHeroUrl = nowPlayingArt?.heroUrl,coverMotionUrl = nowPlayingArt?.motionUrl,coverSquareUrl = nowPlayingArt?.coverUrl,@@ -2924,6 +2958,30 @@ fun SquareApp(else viewModel.toggleDownload(playlist)}}+ // The link to the page, which used to be a button of+ // its own beside the cover. Sharing is occasional and+ // it is done once; the place next to the page's title+ // now filters its songs, which is what gets used while+ // the page is open.+ TrackSheetAction(+ stringResource(R.string.copy_link),+ PhosphorIcons.Regular.Export,+ ) {+ playlistMenu = null+ context.startActivity(+ android.content.Intent.createChooser(+ android.content.Intent(android.content.Intent.ACTION_SEND)+ .setType("text/plain")+ .putExtra(+ android.content.Intent.EXTRA_TEXT,+ dev.lelonio.square.ui.library.openLinkOf(+ shownPlaylist.uri,+ ),+ ),+ null,+ ),+ )+ }if (editable) TrackSheetAction(stringResource(R.string.delete),PhosphorIcons.Regular.Trash,@@ -3274,24 +3332,21 @@ fun SquareApp(* which is where the blurred copy of the artwork went.*/@Composable-private fun AppBackdrop(- artworkUrl: String?,- /** The catalogue's own page colour for what is playing; see pageColorForHex. */- tintHex: String? = null,-) {- val accent by rememberArtworkColor(artworkUrl.takeIf { tintHex == null })- // Eased rather than cut: a track change would otherwise repaint the- // whole window in one frame, which reads as a flash.- val tone by animateColorAsState(- targetValue = if (tintHex != null) pageColorForHex(tintHex) else pageColorFor(accent),- animationSpec = tween(durationMillis = 700),- label = "pageTone",- )- // One colour, held. It used to slide to the floor over the lower half,- // which read as the page running out of light rather than as a page with a- // colour — and under a screen of shelves there is nothing for a gradient to- // describe anyway.- Box(Modifier.fillMaxSize().background(tone))+private fun AppBackdrop() {+ // Neutral, and the same on every page the app assembles.+ //+ // These screens used to take the colour of whatever was playing. On a page+ // that is *about* one record — its own page, or the player — that is right,+ // and it stays. On a screen made of other people's covers it is a wash+ // under a hundred artworks that have nothing to do with it: on the New tab+ // a salmon ground had every sleeve fighting it, and the reference keeps+ // exactly these pages black or white for that reason.+ //+ // The record's colour did not go anywhere. It is on the page of the record+ // itself, on the player, and on the controls that mean "this one, now" —+ // the play button, the lit tab, the row that is playing — which is where a+ // colour says something.+ Box(Modifier.fillMaxSize().background(pageGround()))}@Composable@@ -3720,3 +3775,13 @@ private suspend fun awaitAudible(/** How long the extras wait for the song; see [awaitAudible]. */private const val AUDIBLE_TIMEOUT_MS = 5_000L++/** The one colour a row of sampled columns amounts to. */+private fun List<Color>.mean(): Color {+ if (isEmpty()) return Color.Black+ return Color(+ red = sumOf { it.red.toDouble() }.toFloat() / size,+ green = sumOf { it.green.toDouble() }.toFloat() / size,+ blue = sumOf { it.blue.toDouble() }.toFloat() / size,+ )+}diff --git a/app/src/main/java/dev/lelonio/square/ui/browse/NewScreen.kt b/app/src/main/java/dev/lelonio/square/ui/browse/NewScreen.ktindex ba4012b..d00462e 100644--- a/app/src/main/java/dev/lelonio/square/ui/browse/NewScreen.kt+++ b/app/src/main/java/dev/lelonio/square/ui/browse/NewScreen.kt@@ -3,12 +3,14 @@ package dev.lelonio.square.ui.browseimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxWithConstraintsimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.aspectRatioimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.heightimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.width@@ -17,11 +19,14 @@ import androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.lazy.itemsIndexedimport androidx.compose.foundation.lazy.LazyListScope+import androidx.compose.foundation.shape.CircleShapeimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.Iconimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Textimport androidx.compose.runtime.Composable+import androidx.compose.runtime.rememberimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip@@ -29,8 +34,13 @@ import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dpimport androidx.compose.ui.unit.sp+import com.adamglin.PhosphorIcons+import com.adamglin.phosphoricons.Bold+import com.adamglin.phosphoricons.bold.CaretRight+import com.adamglin.phosphoricons.bold.DotsThreeimport dev.lelonio.square.Rimport dev.lelonio.square.data.CatalogTrackimport dev.lelonio.square.data.SearchItem@@ -69,6 +79,8 @@ fun NewScreen(contentPadding: PaddingValues,onOpen: (SearchItem) -> Unit,onPlaySong: (List<CatalogTrack>, Int) -> Unit,+ /** The same menu every other list of songs in the app opens. */+ onSongMenu: (CatalogTrack) -> Unit,) {val empty = page.hero.isEmpty() && page.thisWeek.isEmpty() &&page.recent.isEmpty() && shelves.isEmpty()@@ -96,28 +108,21 @@ fun NewScreen(item(contentType = "title") {Text(stringResource(R.string.tab_new),- style = MaterialTheme.typography.headlineMedium,+ style = MaterialTheme.typography.displaySmall,fontWeight = FontWeight.Bold,- modifier = Modifier.padding(start = 20.dp, top = 4.dp, bottom = 10.dp),+ modifier = Modifier.padding(start = 20.dp, top = 6.dp, bottom = 14.dp),)}if (page.hero.isNotEmpty()) {- item(contentType = "hero") {- LazyRow(- contentPadding = PaddingValues(horizontal = 20.dp),- horizontalArrangement = Arrangement.spacedBy(14.dp),- ) {- items(page.hero, key = { it.uri }) { item ->- HeroCard(item) { onOpen(item) }- }- }- }+ item(contentType = "hero") { HeroPager(page.hero, onOpen) }}if (page.songs.isNotEmpty()) {- item(contentType = "songsHeading") { Heading(stringResource(R.string.new_songs)) }- songRows(page.songs, onPlaySong)+ item(contentType = "songsHeading") {+ Heading(stringResource(R.string.new_songs), more = true)+ }+ item(contentType = "songs") { SongPages(page.songs, onSongMenu, onPlaySong) }}// The outline of what is coming, while it is coming.@@ -136,7 +141,7 @@ fun NewScreen(// assembled them.shelves.forEach { shelf ->item(key = "shelf ${shelf.title}", contentType = "shelfHeading") {- Heading(shelf.title)+ Heading(shelf.title, more = true)}item(key = "shelfRow ${shelf.title}", contentType = "shelfRow") {Shelf(@@ -154,7 +159,9 @@ fun NewScreen(}if (page.thisWeek.isNotEmpty()) {- item(contentType = "weekHeading") { Heading(stringResource(R.string.new_this_week)) }+ item(contentType = "weekHeading") {+ Heading(stringResource(R.string.new_this_week), more = true)+ }item(contentType = "week") { Shelf(page.thisWeek, onOpen) }}@@ -168,7 +175,7 @@ fun NewScreen(// the gateway will not answer for.if (page.recent.isNotEmpty() && shelves.isEmpty()) {item(contentType = "recentHeading") {- Heading(stringResource(R.string.new_releases_title))+ Heading(stringResource(R.string.new_releases_title), more = true)}item(contentType = "recent") { Shelf(page.recent, onOpen) }}@@ -178,75 +185,127 @@ fun NewScreen(/** How many outlines stand in for the rows that are coming. */private const val SKELETON_ROWS = 3-/** The songs, one row each, played as a list rather than one at a time. */-private fun LazyListScope.songRows(- songs: List<CatalogTrack>,- onPlay: (List<CatalogTrack>, Int) -> Unit,-) {- itemsIndexed(- items = songs,- key = { _, track -> "song ${track.uri}" },- contentType = { _, _ -> "song" },- ) { index, track ->- SongRow(track) { onPlay(songs, index) }- }-}-/**- * A record the page is leading with.+ * The records the page is leading with, one screen at a time.*- * Wide rather than square: the reference's picks carry a line of editorial- * under them and read as a card, and a square cover in a row of square covers- * is a result no matter how large it is drawn.+ * Laid out the way the reference lays this out, which is not a shelf: the+ * writing sits *above* the picture — a small line saying what kind of thing it+ * is, then its name, then who it is by — and the picture is a wide card almost+ * the width of the screen with the next one showing at the edge. A square in a+ * row of squares reads as a result however large it is drawn; this reads as+ * somebody having chosen it.*/@Composable-private fun HeroCard(item: SearchItem, onClick: () -> Unit) {- val shape = RoundedCornerShape(16.dp)- Column(- Modifier- .width(268.dp)- .clip(shape)- .background(Color.White.copy(alpha = 0.06f))- .pressable(onClick, shape = shape, pressedScale = 0.98f)- .padding(bottom = 14.dp),- ) {- Artwork(- url = item.artworkUrl,- title = item.title,- modifier = Modifier- .fillMaxWidth()- .aspectRatio(1f),- corner = 0.dp,- )+private fun HeroPager(items: List<SearchItem>, onOpen: (SearchItem) -> Unit) {+ BoxWithConstraints {+ // Almost the whole width, with the next card showing at the edge: the+ // peek is what says the row can be moved.+ val cardWidth = maxWidth - 68.dp+ LazyRow(+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(14.dp),+ ) {+ items(items, key = { it.uri }) { item ->+ HeroCard(item, cardWidth) { onOpen(item) }+ }+ }+ }+}++@Composable+private fun HeroCard(item: SearchItem, width: Dp, onClick: () -> Unit) {+ val shape = RoundedCornerShape(14.dp)+ Column(Modifier.width(width)) {Text(stringResource(R.string.new_release_tag).uppercase(),style = MaterialTheme.typography.labelSmall,- fontSize = 10.sp,+ fontSize = 11.sp,fontWeight = FontWeight.Bold,- color = MaterialTheme.colorScheme.primary,- modifier = Modifier.padding(start = 14.dp, end = 14.dp, top = 12.dp),+ color = InkDim,+ maxLines = 1,)Text(item.title,- style = MaterialTheme.typography.titleMedium,- fontWeight = FontWeight.SemiBold,+ style = MaterialTheme.typography.titleLarge,+ fontWeight = FontWeight.Bold,maxLines = 1,overflow = TextOverflow.Ellipsis,- modifier = Modifier.padding(horizontal = 14.dp),+ modifier = Modifier.padding(top = 2.dp),)if (item.subtitle.isNotBlank()) {Text(item.subtitle,- style = MaterialTheme.typography.bodySmall,+ style = MaterialTheme.typography.titleMedium,color = InkDim,maxLines = 1,overflow = TextOverflow.Ellipsis,- modifier = Modifier.padding(horizontal = 14.dp),)}+ Artwork(+ url = item.artworkUrl,+ title = item.title,+ modifier = Modifier+ .padding(top = 10.dp)+ .fillMaxWidth()+ // Wide rather than square, which is the shape an editorial card+ // is drawn in and the shape that leaves room for the next one.+ .aspectRatio(16f / 10f)+ .clip(shape)+ .pressable(onClick, shape = shape, pressedScale = 0.98f),+ corner = 0.dp,+ )+ }+}++/**+ * The new songs, four to a screen, moved sideways rather than down.+ *+ * The reference does not put a list of songs on this page — it puts a block of+ * four and lets the block move, so the songs take one screenful however many+ * there are. Down the page they would push everything under them off it.+ */+@Composable+private fun SongPages(+ songs: List<CatalogTrack>,+ onMenu: (CatalogTrack) -> Unit,+ onPlay: (List<CatalogTrack>, Int) -> Unit,+) {+ val pages = remember(songs) { songs.chunked(SONGS_PER_PAGE) }+ BoxWithConstraints {+ val pageWidth = maxWidth - 56.dp+ LazyRow(+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ ) {+ itemsIndexed(+ items = pages,+ key = { index, _ -> "songPage $index" },+ ) { pageIndex, page ->+ Column(Modifier.width(pageWidth)) {+ page.forEachIndexed { rowIndex, track ->+ val at = pageIndex * SONGS_PER_PAGE + rowIndex+ SongRow(track, onMenu = { onMenu(track) }) { onPlay(songs, at) }+ // A hairline between the rows and none under the last,+ // which is what makes four rows read as one block.+ if (rowIndex < page.lastIndex) {+ Box(+ Modifier+ .padding(start = 60.dp)+ .fillMaxWidth()+ .height(0.6.dp)+ .background(InkDim.copy(alpha = 0.16f)),+ )+ }+ }+ }+ }+ }}}+/** How many songs stand in one screenful; the reference shows four. */+private const val SONGS_PER_PAGE = 4+/** A row of records, scrolled sideways. */@Composableprivate fun Shelf(items: List<SearchItem>, onOpen: (SearchItem) -> Unit) {@@ -292,15 +351,17 @@ private fun Shelf(items: List<SearchItem>, onOpen: (SearchItem) -> Unit) {/** One new song, in the same shape the track lists everywhere else use. */@Composable-private fun SongRow(track: CatalogTrack, onClick: () -> Unit) {+private fun SongRow(track: CatalogTrack, onMenu: () -> Unit, onClick: () -> Unit) {val shape = RoundedCornerShape(12.dp)+ // No margin of its own: the block it sits in is already inset to the+ // page's own edge, and a second inset had the songs starting further in+ // than every other row on the screen.Row(Modifier.fillMaxWidth()- .padding(horizontal = 18.dp, vertical = 2.dp).clip(shape).pressable(onClick, shape = shape, pressedScale = 0.985f)- .padding(horizontal = 6.dp, vertical = 8.dp),+ .padding(vertical = 8.dp),verticalAlignment = Alignment.CenterVertically,) {Artwork(@@ -329,15 +390,58 @@ private fun SongRow(track: CatalogTrack, onClick: () -> Unit) {overflow = TextOverflow.Ellipsis,)}++ // What every other list of songs in the app carries, and what the+ // reference puts on each of these rows: the way to the song itself+ // rather than to playing it.+ Box(+ Modifier+ .size(38.dp)+ .clip(CircleShape)+ .pressable(onMenu, shape = CircleShape, pressedScale = 0.9f),+ contentAlignment = Alignment.Center,+ ) {+ Icon(+ PhosphorIcons.Bold.DotsThree,+ contentDescription = stringResource(R.string.more),+ tint = InkDim,+ modifier = Modifier.size(20.dp),+ )+ }}}+/**+ * A section's name, with the mark that says there is more of it.+ *+ * The mark is not a control yet — the rows it would open are the same rows the+ * shelf is already showing — but the reference sets its headings this way and+ * without it they read as labels rather than as places.+ */@Composable-private fun Heading(text: String) {- Text(- text,- style = MaterialTheme.typography.titleLarge,- fontWeight = FontWeight.Bold,- modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 26.dp, bottom = 10.dp),- )+private fun Heading(text: String, more: Boolean = false) {+ Row(+ Modifier+ .fillMaxWidth()+ .padding(start = 20.dp, end = 20.dp, top = 26.dp, bottom = 10.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text,+ style = MaterialTheme.typography.titleLarge,+ fontWeight = FontWeight.Bold,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ )+ if (more) {+ Icon(+ PhosphorIcons.Bold.CaretRight,+ contentDescription = null,+ tint = InkDim,+ modifier = Modifier+ .padding(start = 6.dp)+ .size(15.dp),+ )+ }+ }}diff --git a/app/src/main/java/dev/lelonio/square/ui/components/AmbientArtworkBackground.kt b/app/src/main/java/dev/lelonio/square/ui/components/AmbientArtworkBackground.ktindex d7295f0..f1975c2 100644--- a/app/src/main/java/dev/lelonio/square/ui/components/AmbientArtworkBackground.kt+++ b/app/src/main/java/dev/lelonio/square/ui/components/AmbientArtworkBackground.kt@@ -140,6 +140,17 @@ fun AmbientArtworkBackground(* this could cost a frame.*/motion: Boolean = true,+ /**+ * The foot of a moving picture, across its width — see CanvasSurface.+ *+ * When a Canvas is playing, the picture the screen is made of is the clip,+ * not the sleeve, and the field under it has to be the clip's. These are+ * column averages of the clip's own bottom band, painted across the width+ * the way the still copy's last row is carried down: a red shape at the+ * foot of the frame goes on being red under it, and a dark corner stays+ * dark. Empty puts the cover's own copies back.+ */+ columns: List<Color> = emptyList(),) {val context = LocalContext.current@@ -242,7 +253,85 @@ fun AmbientArtworkBackground(}BoxWithConstraints(modifier.fillMaxSize().background(settledTone)) {- if (enabled) {+ if (columns.isNotEmpty()) {+ // Eased one column at a time, and slowly: a field that tracked+ // every cut would strobe, and this is meant to read as the light+ // the clip is throwing rather than as the clip itself.+ // Smoothed across before anything is drawn.+ //+ // The columns are averages of neighbouring strips of one frame, so+ // where the clip has an edge the two strips either side of it are+ // genuinely different colours — and a gradient between them puts+ // that edge back on the screen as a seam. Averaged with their+ // neighbours a few times over, what is left is where the colour is+ // rather than where the shape was: it reads as light, which is the+ // whole point of it.+ val spread = remember(columns) { columns.spread(SPREAD_PASSES, SPREAD_RADIUS) }+ val eased = spread.map { target ->+ animateColorAsState(+ targetValue = target,+ animationSpec = tween(durationMillis = CLIP_TONE_MS),+ label = "clipColumn",+ ).value+ }+ Box(Modifier.fillMaxSize().background(Brush.horizontalGradient(eased)))++ // The shapes merge into one colour as they go down.+ //+ // A gradient repeated unchanged down the screen keeps the clip's+ // red flood as a hard-edged stripe running the whole height, which+ // is not what carrying a picture's foot downwards looks like — the+ // still copy's own stretch is blurred, so its shapes dissolve. This+ // is that dissolve: the columns are what meets the fade, and a few+ // hundred points lower they have become their own average.+ val mean = remember(eased) {+ if (eased.isEmpty()) {+ Color.Transparent+ } else {+ Color(+ red = eased.sumOf { it.red.toDouble() }.toFloat() / eased.size,+ green = eased.sumOf { it.green.toDouble() }.toFloat() / eased.size,+ blue = eased.sumOf { it.blue.toDouble() }.toFloat() / eased.size,+ )+ }+ }+ Box(+ Modifier+ .fillMaxSize()+ .background(+ Brush.verticalGradient(+ 0f to Color.Transparent,+ settleFrom to Color.Transparent,+ (settleFrom + (1f - settleFrom) * 0.42f) to mean.copy(alpha = 0.72f),+ 1f to mean,+ ),+ ),+ )++ // And damped on the way down.+ //+ // The columns are the clip's own foot, and a clip's foot is often+ // the brightest thing in it: painted flat down the screen it left+ // the transport sitting on a field louder than the picture it came+ // from. This keeps the colour where the fade meets it and takes the+ // light out of it further down, which is what the still copy's own+ // stretch does by simply running out of picture.+ Box(+ Modifier+ .fillMaxSize()+ .background(+ Brush.verticalGradient(+ 0f to Color.Transparent,+ settleFrom to Color.Transparent,+ (settleFrom + (1f - settleFrom) * 0.45f)+ to Color.Black.copy(alpha = 0.20f),+ 1f to Color.Black.copy(alpha = 0.46f),+ ),+ ),+ )+ }++ if (enabled && columns.isEmpty()) {// The far copy, laid over the sharp one exactly.//// Same width, same top, same proportions, so every row of it is the@@ -585,6 +674,44 @@ private const val READY_MS = 1_800/** And the colour under it, which is slower still. */private const val TONE_MS = 900+/** How long the field takes to become the clip's next colours. */+private const val CLIP_TONE_MS = 1_800++/** How far each colour is averaged into its neighbours, and how many times. */+private const val SPREAD_RADIUS = 4+private const val SPREAD_PASSES = 3++/**+ * A list of colours with the edges taken out of it.+ *+ * A box blur along the list, repeated: three passes of a running mean is close+ * enough to a gaussian that nothing in it can be found, and on two dozen+ * values it costs nothing. The ends are held rather than wrapped — the left of+ * the screen is not next to the right.+ */+private fun List<Color>.spread(passes: Int, radius: Int): List<Color> {+ if (size < 3 || radius < 1) return this+ var current = this+ repeat(passes) {+ current = current.mapIndexed { index, _ ->+ var r = 0f+ var g = 0f+ var b = 0f+ var count = 0+ for (offset in -radius..radius) {+ val at = (index + offset).coerceIn(0, current.lastIndex)+ val colour = current[at]+ r += colour.red+ g += colour.green+ b += colour.blue+ count+++ }+ Color(r / count, g / count, b / count)+ }+ }+ return current+}+/** How much the picture leaving grows, and the one arriving shrinks. */private const val LEAVE_SWELL = 0.05fprivate const val ARRIVE_SWELL = 0.06fdiff --git a/app/src/main/java/dev/lelonio/square/ui/components/FilterChip.kt b/app/src/main/java/dev/lelonio/square/ui/components/FilterChip.ktnew file mode 100644index 0000000..5064a7e--- /dev/null+++ b/app/src/main/java/dev/lelonio/square/ui/components/FilterChip.kt@@ -0,0 +1,96 @@+package dev.lelonio.square.ui.components++import androidx.compose.animation.animateColorAsState+import androidx.compose.animation.core.tween+import androidx.compose.foundation.background+import androidx.compose.foundation.border+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.defaultMinSize+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import dev.lelonio.square.ui.glass.pressable+import dev.lelonio.square.ui.theme.Ink+import dev.lelonio.square.ui.theme.lightPage+import dev.lelonio.square.ui.theme.pageGround++/**+ * One of a row of filters, drawn the way the reference draws them.+ *+ * Flat, not glass. Every chip in this app used to be a pane of the same liquid+ * material as the bars, with the lit one filled a little harder and washed with+ * the artwork's colour. Over a tinted page that read as one family; over the+ * neutral ground these pages have now it reads as a row of grey lozenges with a+ * colour in them that belongs to something else on the screen.+ *+ * The reference is much plainer and says more with less: an unlit chip is a+ * whisper of the ink it is written in, and the lit one is the ink itself with+ * the page's own colour for a label. There is no third state and no accent —+ * being *on* is carried entirely by the inversion, which is legible at a glance+ * and in both themes without a single value changing side.+ */+@Composable+fun FilterChip(+ label: String,+ selected: Boolean,+ onClick: () -> Unit,+ modifier: Modifier = Modifier,+) {+ // An unlit chip is a card, not a film: on the reference it is white with a+ // hairline round it, sitting on a grey page. Taken to this app's two sides+ // that is "a shade away from the ground, outlined" — white on the light+ // side, and a lift out of the floor on the dark one.+ val resting = if (lightPage()) Color.White else Ink.copy(alpha = 0.09f)++ // Eased, because a row of these is usually tapped along and a cut between+ // two solid fills reads as the row redrawing itself.+ val fill by animateColorAsState(+ targetValue = if (selected) Ink else resting,+ animationSpec = tween(durationMillis = 180),+ label = "chipFill",+ )+ val labelInk by animateColorAsState(+ targetValue = if (selected) pageGround() else Ink,+ animationSpec = tween(durationMillis = 180),+ label = "chipInk",+ )+ val edge by animateColorAsState(+ targetValue = if (selected) Color.Transparent else Ink.copy(alpha = 0.14f),+ animationSpec = tween(durationMillis = 180),+ label = "chipEdge",+ )++ Box(+ modifier+ .clip(CircleShape)+ .background(fill)+ .border(1.dp, edge, CircleShape)+ .pressable(onClick, shape = CircleShape, pressedScale = 0.94f)+ .defaultMinSize(minHeight = CHIP_HEIGHT)+ .padding(horizontal = CHIP_PADDING, vertical = 7.dp),+ contentAlignment = Alignment.Center,+ ) {+ Text(+ label,+ style = MaterialTheme.typography.bodyMedium,+ fontWeight = FontWeight.SemiBold,+ color = labelInk,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ )+ }+}++/** Measured off the reference: shorter and tighter than the glass ones were. */+private val CHIP_HEIGHT = 34.dp+private val CHIP_PADDING = 16.dpdiff --git a/app/src/main/java/dev/lelonio/square/ui/components/ListSearchField.kt b/app/src/main/java/dev/lelonio/square/ui/components/ListSearchField.ktnew file mode 100644index 0000000..52c327f--- /dev/null+++ b/app/src/main/java/dev/lelonio/square/ui/components/ListSearchField.kt@@ -0,0 +1,202 @@+package dev.lelonio.square.ui.components++import androidx.compose.foundation.background+import androidx.compose.foundation.border+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.text.BasicTextField+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.material3.Icon+import androidx.compose.material3.LocalTextStyle+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.remember+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.SolidColor+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.input.ImeAction+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.dp+import com.adamglin.PhosphorIcons+import com.adamglin.phosphoricons.Bold+import com.adamglin.phosphoricons.Regular+import com.adamglin.phosphoricons.bold.MagnifyingGlass+import com.adamglin.phosphoricons.regular.X+import dev.lelonio.square.R+import dev.lelonio.square.ui.glass.LocalGlassEffectConfig+import dev.lelonio.square.ui.glass.backdrop.Backdrop+import dev.lelonio.square.ui.glass.liquidGlass+import dev.lelonio.square.ui.glass.pressable+import dev.lelonio.square.ui.theme.Ink+import dev.lelonio.square.ui.theme.InkDim+import dev.lelonio.square.ui.theme.lightPage++/**+ * The field that filters a list, drawn the way the reference draws it.+ *+ * One shape for both places it appears — the library's own lists, and the songs+ * inside a record — because they are the same act: narrowing what is already on+ * the screen. It is deliberately not the app's search: there is no result page+ * behind it, nothing is fetched, and it takes what it filters from the list it+ * sits at the top of.+ *+ * Two materials, one shape. In a page that scrolls, the field is a shade off+ * the paper, because that is what a row of a list is made of. Floating over a+ * cover it is a pane of the app's own glass — the same film and the same rim as+ * the capsule it takes the place of, since a flat grey box among the header's+ * glass buttons reads as a control from another app. Which one it is is decided+ * by whether the caller hands it something to refract.+ *+ * Built out of [BasicTextField] rather than Material's own. The filled and+ * outlined fields carry a label slot, an indicator line and a height this+ * shape has no use for, and every one of them had to be turned off before the+ * field looked like a search bar rather than a form.+ */+@Composable+fun ListSearchField(+ query: String,+ onQuery: (String) -> Unit,+ modifier: Modifier = Modifier,+ placeholder: String = stringResource(R.string.search_in_tracks),+ /**+ * What the pane refracts. Null keeps the flat fill, which is what a field+ * sitting in the page itself wants.+ */+ backdrop: Backdrop? = null,+ /** Matched to the buttons beside it where it floats; a list row where it does not. */+ height: Dp = 38.dp,+ /** The glyphs' colour: the page's own ink here, the chrome's over a cover. */+ ink: Color = Ink,+ hint: Color = InkDim,+ /**+ * Focus on arrival.+ *+ * For the field that opens out of a button: whoever pressed the magnifier+ * means to type, and a field that arrives needing one more tap is the tap+ * they already made.+ */+ autoFocus: Boolean = false,+ /**+ * How present the contents are, read on every frame rather than in+ * composition — see the header's growing field, which fades them in behind+ * its own opening. A lambda so nothing here recomposes while it travels.+ */+ contentAlpha: () -> Float = FullyPresent,+) {+ val glass = backdrop != null+ val shape = if (glass) RoundedCornerShape(percent = 50) else RoundedCornerShape(11.dp)+ // A shade off the page: lifted out of the floor on the dark side, pressed+ // into the paper on the light one.+ val fill = if (lightPage()) Ink.copy(alpha = 0.06f) else Ink.copy(alpha = 0.10f)++ val focus = remember { FocusRequester() }+ if (autoFocus) {+ LaunchedEffect(Unit) { runCatching { focus.requestFocus() } }+ }++ val surface = if (backdrop != null) {+ val config = LocalGlassEffectConfig.current+ Modifier+ .clip(shape)+ .liquidGlass(+ config = config,+ shape = shape,+ blurRadiusDp = config.blurRadius,+ ownBackdrop = backdrop,+ )+ // The drawn edge that separates the pane from the artwork behind+ // it, at the weight the header's capsule carries.+ .border(0.6.dp, Color.White.copy(alpha = 0.30f), shape)+ } else {+ Modifier+ .clip(shape)+ .background(fill)+ }++ Row(+ modifier+ .fillMaxWidth()+ .height(height)+ .then(surface)+ // After the material, so what fades is the writing and not the pane+ // it is written on.+ .graphicsLayer { alpha = contentAlpha() }+ .padding(horizontal = if (glass) 14.dp else 10.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Icon(+ PhosphorIcons.Bold.MagnifyingGlass,+ contentDescription = null,+ tint = hint,+ modifier = Modifier.size(16.dp),+ )++ Box(+ Modifier+ .weight(1f)+ .padding(start = 8.dp),+ contentAlignment = Alignment.CenterStart,+ ) {+ if (query.isEmpty()) {+ Text(+ placeholder,+ style = MaterialTheme.typography.bodyMedium,+ color = hint,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ )+ }+ BasicTextField(+ value = query,+ onValueChange = onQuery,+ singleLine = true,+ textStyle = LocalTextStyle.current.merge(+ MaterialTheme.typography.bodyMedium,+ ).copy(color = ink),+ cursorBrush = SolidColor(+ if (glass) ink else MaterialTheme.colorScheme.primary,+ ),+ keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),+ modifier = Modifier+ .fillMaxWidth()+ .focusRequester(focus),+ )+ }++ if (query.isNotEmpty()) {+ Box(+ Modifier+ .size(22.dp)+ .clip(CircleShape)+ .background(ink.copy(alpha = 0.14f))+ .pressable({ onQuery("") }, shape = CircleShape, pressedScale = 0.88f),+ contentAlignment = Alignment.Center,+ ) {+ Icon(+ PhosphorIcons.Regular.X,+ contentDescription = stringResource(R.string.clear),+ tint = ink,+ modifier = Modifier.size(12.dp),+ )+ }+ }+ }+}++/** The default for [ListSearchField]'s fade: a field that is simply there. */+private val FullyPresent: () -> Float = { 1f }diff --git a/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.kt b/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.ktindex 69cf690..f62a775 100644--- a/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.kt+++ b/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.kt@@ -452,6 +452,15 @@ fun Modifier.liquidGlass(val backdropLuminance = LocalBackdropLuminance.currentval surfaceTintColor = if (config.surfaceTintColor.isSpecified) {config.surfaceTintColor+ } else if (dev.lelonio.square.ui.theme.LocalInkOverride.current != null) {+ // A surface whose ink was chosen for it takes the opposite film.+ //+ // On the player and on a record's page the ink is decided by what is+ // behind the glass rather than by the phone's setting, and a film that+ // followed the setting anyway put light glyphs on a light pane over a+ // dark Canvas.+ val ink = dev.lelonio.square.ui.theme.LocalInkOverride.current+ if ((ink?.luminance() ?: 1f) > 0.5f) Color(0xFF23232A) else Color(0xFFFAFAFA)} else if (dev.lelonio.square.ui.theme.LocalLightTheme.current) {Color(0xFFFAFAFA)} else {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 6547e86..fb3f049 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@@ -576,9 +576,17 @@ private fun Header(.fillMaxWidth()// Seats the header on the page instead of leaving it floating over// whatever the list has scrolled underneath it.+ //+ // In the page's own colour rather than in black. Black was right+ // while every page was a tinted wash and a little more darkness at+ // the top read as depth; over a neutral ground it is a grey band+ // across the top of every screen, and on the light side it is a+ // smudge. Fading from the ground colour does the same job — the+ // rows disappear under the header instead of running into it — and+ // leaves no band when there is nothing scrolled under it..background(Brush.verticalGradient(- 0f to Color.Black.copy(alpha = 0.45f),+ 0f to dev.lelonio.square.ui.theme.pageGround(),1f to Color.Transparent,),)@@ -718,26 +726,11 @@ private fun FilterRow(selected: Feed, backdrop: Backdrop, onSelect: (Feed) -> Unmodifier = Modifier.padding(top = 14.dp, bottom = 10.dp),) {items(Feed.entries.toList(), key = { it.name }) { entry ->- val isSelected = entry == selected- LiquidButton(+ dev.lelonio.square.ui.components.FilterChip(+ label = stringResource(entry.label),+ selected = entry == selected,onClick = { onSelect(entry) },- backdrop = backdrop,- // Scrolls with the page; see LiquidButton's `flat`.- flat = true,- contentHeight = 38.dp,- contentPadding = 18.dp,- // The selected chip is the same glass, filled a little harder.- // A tinted fill would put the artwork's colour on a control- // whose whole job is to be legible over any artwork.- surfaceColor = if (isSelected) SelectedFilm else Color.Unspecified,- wash = dev.lelonio.square.ui.glass.chipWash(isSelected),- ) {- Text(- stringResource(entry.label),- style = MaterialTheme.typography.bodyMedium,- color = if (isSelected) Ink else InkDim,- )- }+ )}}}@@ -1187,23 +1180,13 @@ private fun ChipRow() {items(chips, key = { it.title }) { chip ->val isSelected = chip.title == selected- LiquidButton(+ dev.lelonio.square.ui.components.FilterChip(+ label = chip.title,+ selected = isSelected,// Pressing the chip that is already on takes the filter off,// which is what the service's own deselect does.onClick = { onPick(if (isSelected) null else chip) },- backdrop = backdrop,- flat = true,- contentHeight = 38.dp,- contentPadding = 18.dp,- surfaceColor = if (isSelected) SelectedFilm else Color.Unspecified,- wash = dev.lelonio.square.ui.glass.chipWash(isSelected),- ) {- Text(- chip.title,- style = MaterialTheme.typography.bodyMedium,- color = if (isSelected) Ink else InkDim,- )- }+ )}}}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.ktindex 35014df..9e5e0a1 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@@ -211,15 +211,24 @@ fun LibraryScreen(}}- val playlists = remember(shown, playlistOrder, pinned, order, descending) {+ // What the field at the top of the list is asking for, on top of the+ // chips: the same act as the field inside a record, narrowing what+ // is already here rather than fetching anything.+ var query by remember { mutableStateOf("") }+ val matching = remember(shown, query) {+ if (query.isBlank()) shown+ else shown.filter { it.name.contains(query.trim(), ignoreCase = true) }+ }++ val playlists = remember(matching, playlistOrder, pinned, order, descending) {when (order) {- Order.RECENT -> shown.sortedByRecentlyOpened(playlistOrder)- Order.NAME -> shown.sortedWith(+ Order.RECENT -> matching.sortedByRecentlyOpened(playlistOrder)+ Order.NAME -> matching.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name },)// The order the account added them, which is what the// rootlist arrives in.- Order.ADDED -> shown+ Order.ADDED -> matching}// The direction belongs to the sort rather than beside it:// reversing "recently opened" is "least recently", and a@@ -273,6 +282,15 @@ fun LibraryScreen(.fillMaxSize().layerBackdrop(listBackdrop),) {+ item(span = { GridItemSpan(maxLineSpan) }, key = "search") {+ dev.lelonio.square.ui.components.ListSearchField(+ query = query,+ onQuery = { query = it },+ placeholder = stringResource(R.string.search_library),+ modifier = Modifier.padding(bottom = 4.dp),+ )+ }+// Why the library is shorter than usual, at the top// of the library. Nothing at all when there is a// connection; see OfflineNotice.@@ -307,6 +325,19 @@ fun LibraryScreen(.fillMaxSize().layerBackdrop(listBackdrop),) {+ item(key = "search") {+ dev.lelonio.square.ui.components.ListSearchField(+ query = query,+ onQuery = { query = it },+ placeholder = stringResource(R.string.search_library),+ modifier = Modifier.padding(+ start = 20.dp,+ end = 20.dp,+ bottom = 6.dp,+ ),+ )+ }+item(key = "offline") {dev.lelonio.square.ui.components.OfflineNotice(onRetry = onRetryOnline)}@@ -488,23 +519,11 @@ private fun Header(verticalAlignment = Alignment.CenterVertically,) {Filter.entries.forEach { entry ->- val selected = entry == filter- LiquidButton(+ dev.lelonio.square.ui.components.FilterChip(+ label = stringResource(entry.label),+ selected = entry == filter,onClick = { onFilter(entry) },- backdrop = backdrop,- flat = true,- contentHeight = 36.dp,- contentPadding = 14.dp,- surfaceColor = if (selected) SelectedFilm else Color.Unspecified,- wash = dev.lelonio.square.ui.glass.chipWash(selected),- ) {- Text(- stringResource(entry.label),- style = MaterialTheme.typography.bodySmall,- color = if (selected) Ink else InkDim,- maxLines = 1,- )- }+ )}Spacer(Modifier.weight(1f))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 69f4249..3491db7 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@@ -2,7 +2,10 @@ package dev.lelonio.square.ui.libraryimport androidx.annotation.StringResimport androidx.compose.animation.AnimatedVisibility+import androidx.compose.animation.core.Animatable+import androidx.compose.animation.core.Springimport androidx.compose.animation.core.animateFloatAsState+import androidx.compose.animation.core.springimport androidx.compose.animation.core.tweenimport androidx.compose.foundation.layout.RowScopeimport dev.lelonio.square.ui.glass.liquidGlass@@ -39,8 +42,13 @@ import androidx.compose.runtime.Composableimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import kotlinx.coroutines.launchimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignment+import androidx.compose.foundation.gestures.Orientation+import androidx.compose.foundation.gestures.rememberScrollableState+import androidx.compose.foundation.gestures.scrollableimport androidx.compose.ui.Modifierimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.res.pluralStringResource@@ -83,6 +91,7 @@ import androidx.compose.ui.layout.boundsInRootimport androidx.compose.ui.layout.onGloballyPositionedimport androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.runtime.derivedStateOf+import androidx.compose.runtime.LaunchedEffectimport androidx.compose.foundation.layout.BoxScopeimport dev.lelonio.square.Rimport dev.lelonio.square.data.CatalogTrack@@ -107,6 +116,7 @@ import dev.lelonio.square.ui.theme.rememberArtworkFootColorimport dev.lelonio.square.ui.theme.pageColorForimport dev.lelonio.square.ui.theme.pageColorForHeximport dev.lelonio.square.ui.theme.softShadow+import kotlin.math.roundToIntimport java.util.Localeimport java.util.concurrent.TimeUnitimport com.adamglin.PhosphorIcons@@ -122,7 +132,8 @@ import com.adamglin.phosphoricons.bold.Shuffleimport com.adamglin.phosphoricons.bold.Infoimport com.adamglin.phosphoricons.bold.ArrowDownimport com.adamglin.phosphoricons.bold.CaretLeft-import com.adamglin.phosphoricons.bold.Export+import com.adamglin.phosphoricons.bold.MagnifyingGlass+import com.adamglin.phosphoricons.bold.Ximport com.adamglin.phosphoricons.bold.DotsThreeimport com.adamglin.phosphoricons.bold.Plusimport com.adamglin.phosphoricons.bold.Check@@ -216,7 +227,6 @@ fun PlaylistScreen(dev.lelonio.square.data.DownloadState.None},/** Hands the page's own link to whoever wants it. */- onShare: () -> Unit = {},/*** Asks for the permission to read the music on the phone.*@@ -237,6 +247,36 @@ fun PlaylistScreen() {var query by remember { mutableStateOf("") }var searching by remember { mutableStateOf(false) }+ // Opening and closing the field, as one number.+ //+ // The field used to appear and disappear on the frame the button was+ // pressed, which is the one thing on this page that happened without+ // travelling: the capsule vanished and a grey box stood where it had been.+ // Now the capsule fades and the field grows out from under the way out,+ // and every part of that reads this — inside a `layout` or a+ // `graphicsLayer`, never in composition, so a frame of the opening costs a+ // measure and a draw and nothing recomposes at all. Same discipline as the+ // header's own collapse and the bottom bar's fold.+ val searchOpen = remember { Animatable(0f) }+ val readSearch = remember { { searchOpen.value } }+ val focusManager = androidx.compose.ui.platform.LocalFocusManager.current+ LaunchedEffect(searching) {+ // Let the keyboard go before the field does, or it stays up over a page+ // with nothing left to type into.+ if (!searching && searchOpen.value > 0f) focusManager.clearFocus()+ searchOpen.animateTo(+ if (searching) 1f else 0f,+ // Soft rather than snappy: this is a pane of glass stretching, not+ // a switch. The same spring the bar settles on.+ spring(dampingRatio = 0.9f, stiffness = Spring.StiffnessMediumLow),+ )+ }+ // Composed for the whole of the travel, not only while the field is wanted:+ // closing has to be watched too. Derived so this flips twice a search+ // rather than once a frame.+ val searchPresent by remember {+ derivedStateOf { searching || searchOpen.value > 0.001f }+ }// An artist is not a list with a cover on top of it. It is a photograph of// a person with their name written across it, and the songs come after —// which is a different page, not a differently-worded one, so the header,@@ -378,6 +418,17 @@ fun PlaylistScreen(}}val baseInk = dev.lelonio.square.ui.theme.inkOn(pageColor)+ // What the glass carries, which is not what the page carries.+ //+ // The letters on this page belong to the record: a dark brown page keeps+ // white text in both settings, because the catalogue chose that pairing.+ // The floating controls do not belong to the record — they are the app's+ // own chrome, made of the same film as the bars, and that film follows the+ // phone: white in the light setting, dark in the dark one. Tinting their+ // icons by the record put white glyphs on a white pane whenever a dark+ // record was opened in the light setting.+ val chromeInk = androidx.compose.material3.MaterialTheme.colorScheme.onSurface+val pageInk = catalogueInk?: inkSource?.let { inkTintedBy(it, baseInk) }?: baseInk@@ -414,13 +465,26 @@ fun PlaylistScreen(var collapsed by remember { mutableFloatStateOf(0f) }val collapseFraction = { (collapsed / collapseRange).coerceIn(0f, 1f) }+ // How much of a drag the header itself uses up, closing on the way up and+ // opening on the way down. Written once and used twice: by the list's+ // nested scroll, and by a drag that starts on the picture.+ val takeForHeader: (Float) -> Float = { delta ->+ if (delta < 0f) {+ val take = (-delta).coerceAtMost(collapseRange - collapsed)+ collapsed += take+ -take+ } else {+ val give = delta.coerceAtMost(collapsed)+ collapsed -= give+ give+ }+ }+val headerScroll = remember(collapseRange) {object : NestedScrollConnection {override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {if (available.y >= 0f) return Offset.Zero- val take = (-available.y).coerceAtMost(collapseRange - collapsed)- collapsed += take- return Offset(0f, -take)+ return Offset(0f, takeForHeader(available.y))}override fun onPostScroll(@@ -429,13 +493,25 @@ fun PlaylistScreen(source: NestedScrollSource,): Offset {if (available.y <= 0f) return Offset.Zero- val give = available.y.coerceAtMost(collapsed)- collapsed -= give- return Offset(0f, give)+ return Offset(0f, takeForHeader(available.y))}}}+ // The picture scrolls the page too.+ //+ // The header is not in the list — it is pinned above it — so a drag that+ // began on the cover reached nothing at all, and the page only moved if you+ // happened to start on a song. This hands those drags the same treatment+ // the list's own get: the header closes first, and whatever is left of the+ // gesture goes into the rows.+ val scope = rememberCoroutineScope()+ val headerDrag = rememberScrollableState { delta ->+ val used = takeForHeader(delta)+ val rest = delta - used+ if (rest != 0f) used + listState.dispatchRawDelta(-rest).let { -it } else used+ }+val heroPx = with(density) { heroHeight.roundToPx() }val collapsedPx = with(density) { collapsedHeight.roundToPx() }@@ -531,6 +607,16 @@ fun PlaylistScreen(}Column(Modifier.fillMaxSize()) {+ Box(+ // A drag that starts on the cover scrolls the page; see headerDrag.+ // Not reversed: the lambda already speaks the gesture's own+ // language — a finger going down is a positive delta, and it opens+ // the header and scrolls the rows back up.+ Modifier.scrollable(+ state = headerDrag,+ orientation = Orientation.Vertical,+ ),+ ) {if (isArtist) {ArtistHeader(ink = pageInk,@@ -599,6 +685,7 @@ fun PlaylistScreen(heroHeight = heroHeight,)}+ }LazyColumn(state = listState,@@ -688,28 +775,6 @@ fun PlaylistScreen()}- item(contentType = "search") {- AnimatedVisibility(visible = searching) {- OutlinedTextField(- value = query,- onValueChange = { query = it },- placeholder = { Text(stringResource(R.string.search_in_tracks)) },- singleLine = true,- leadingIcon = { Icon(PhosphorIcons.Fill.MagnifyingGlass, contentDescription = null) },- trailingIcon = {- if (query.isNotEmpty()) {- IconButton(onClick = { query = "" }) {- Icon(PhosphorIcons.Regular.X, contentDescription = stringResource(R.string.clear))- }- }- },- shape = RoundedCornerShape(14.dp),- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 24.dp, vertical = 6.dp),- )- }- }}when {@@ -938,6 +1003,20 @@ fun PlaylistScreen(),)+ // The chrome over the picture, outside the page's own ink.+ //+ // This page tells everything inside it to write in the record's ink,+ // because the record owns the page — see LocalInkOverride. These+ // buttons are not the page: they are the app's own controls, made of+ // the film the bars are made of, and the glass reads that same override+ // to pick its film. On a near-black record in the light setting that+ // came out as a dark pane with dark glyphs on it, while the bar at the+ // foot of the same screen was white. Cleared here, they follow the+ // phone like the rest of the chrome: a white pane with dark icons.+ androidx.compose.runtime.CompositionLocalProvider(+ dev.lelonio.square.ui.theme.LocalInkOverride provides null,+ ) {+// Share and everything else, in one capsule opposite the back button.// Two round buttons side by side would have read as two destinations;// one pane with a divide down it reads as what it is, a place where the@@ -945,20 +1024,90 @@ fun PlaylistScreen(// One pane of glass with a line down it, not two buttons side by side.// Two would have read as two destinations; one capsule reads as what it// is, the place the page's own actions live.+ // The field takes the capsule's place while it is open, running from the+ // back button to the edge — the same move the bottom bar makes when its+ // search opens. It used to be a row near the top of the list, which is+ // why opening it from halfway down the page appeared to do nothing.+ if (searchPresent) {+ dev.lelonio.square.ui.components.ListSearchField(+ query = query,+ onQuery = { query = it },+ // The same glass as the capsule it replaces, refracting the+ // same cover, so what happens on the press is one control+ // turning into another rather than a box arriving.+ backdrop = pageBackdrop,+ height = 42.dp,+ ink = chromeInk,+ hint = chromeInk.copy(alpha = 0.55f),+ autoFocus = true,+ // The writing arrives after the pane has somewhere to put it.+ contentAlpha = { ((readSearch() - 0.35f) / 0.65f).coerceIn(0f, 1f) },+ modifier = Modifier+ .align(Alignment.TopStart)+ .padding(+ top = contentPadding.calculateTopPadding() + 8.dp,+ start = 68.dp,+ // Room for the way out, which the capsule was carrying+ // until the field took its place.+ end = 62.dp,+ )+ // A pane cannot appear at full width out of nothing, and it+ // cannot fade in either — glass that fades reads as a+ // photograph of glass. It arrives the width of the button+ // beside it and stretches to the back arrow.+ .growingFromEnd(readSearch, from = 42.dp),+ )++ LiquidButton(+ onClick = {+ searching = false+ query = ""+ },+ backdrop = pageBackdrop,+ modifier = Modifier+ .padding(top = contentPadding.calculateTopPadding() + 8.dp, end = 14.dp)+ .align(Alignment.TopEnd)+ // Takes the capsule's place as the capsule gives it up.+ .graphicsLayer { alpha = (readSearch() / 0.45f).coerceIn(0f, 1f) }+ .size(42.dp),+ contentHeight = 42.dp,+ contentPadding = 0.dp,+ ) {+ Icon(+ PhosphorIcons.Bold.X,+ contentDescription = stringResource(R.string.clear),+ tint = chromeInk,+ modifier = Modifier.size(18.dp),+ )+ }+ }+GlassCapsule(backdrop = pageBackdrop,modifier = Modifier.padding(top = contentPadding.calculateTopPadding() + 8.dp, end = 14.dp).align(Alignment.TopEnd)- .graphicsLayer { alpha = 1f - collapseFraction() },+ // Gone by the time the field is a third open, and faded before+ // that. Out of the layout rather than merely invisible: an+ // invisible capsule still takes every touch aimed at the field.+ .graphicsLayer { alpha = (1f - readSearch() / 0.3f).coerceIn(0f, 1f) }+ .layout { measurable, constraints ->+ if (readSearch() >= 0.3f) {+ layout(0, 0) {}+ } else {+ val placeable = measurable.measure(constraints)+ layout(placeable.width, placeable.height) { placeable.place(0, 0) }+ }+ },) {// Keeping the page, first in the row — where the reference puts the// one action that changes what your library holds, apart from the// controls that only start the music. Absent while the answer is// unknown and on the pages the question does not apply to.if (state.saved != null) {+ CollapsingSlot(collapseFraction) {CapsuleAction(- tint = pageInk,+ tint = chromeInk,icon = if (state.saved) {PhosphorIcons.Bold.Check} else {@@ -969,21 +1118,38 @@ fun PlaylistScreen(),onClick = onToggleSaved,)- CapsuleDivider()+ }+ CollapsingSlot(collapseFraction) { CapsuleDivider() }}+ // Filtering the list, where the link used to be.+ //+ // A link is something you do once and from a menu; narrowing a+ // hundred songs down to the one you meant is something you do while+ // the page is open, and the reference gives that the place next to+ // the page's other actions. Sharing moved under the dots, which is+ // where the rest of a page's occasional business already lives.CapsuleAction(- icon = PhosphorIcons.Bold.Export,- description = stringResource(R.string.copy_link),- onClick = onShare,- tint = pageInk,- )- CapsuleDivider()- CapsuleAction(- icon = PhosphorIcons.Bold.DotsThree,- description = stringResource(R.string.more),- onClick = onMenu,- tint = pageInk,+ icon = if (searching) {+ PhosphorIcons.Bold.X+ } else {+ PhosphorIcons.Bold.MagnifyingGlass+ },+ description = stringResource(R.string.search_in_tracks),+ onClick = {+ searching = !searching+ if (!searching) query = ""+ },+ tint = chromeInk,)+ CollapsingSlot(collapseFraction) { CapsuleDivider() }+ CollapsingSlot(collapseFraction) {+ CapsuleAction(+ icon = PhosphorIcons.Bold.DotsThree,+ description = stringResource(R.string.more),+ onClick = onMenu,+ tint = chromeInk,+ )+ }}// Floating rather than a top bar: the list scrolls under it, so the@@ -995,19 +1161,20 @@ fun PlaylistScreen(modifier = Modifier.padding(top = contentPadding.calculateTopPadding() + 8.dp, start = 14.dp).align(Alignment.TopStart)- .size(42.dp)- .graphicsLayer { alpha = 1f - collapseFraction() },+ .size(42.dp),contentHeight = 42.dp,contentPadding = 0.dp,) {Icon(PhosphorIcons.Bold.CaretLeft,contentDescription = stringResource(R.string.back),- tint = pageInk,+ tint = chromeInk,modifier = Modifier.size(20.dp),)}+ }+// In the page rather than in a popup of its own: the sort button is up// by the header, well clear of the bars that would otherwise be drawn// over this, so it can be real glass instead of a dark card.@@ -1268,6 +1435,81 @@ private fun DetailHeader(}}+/**+ * Grows a control out of its own right-hand edge.+ *+ * How the search field opens: it keeps the place the way out already occupies+ * and takes the rest of the row from it, so the motion starts where the finger+ * was rather than in the middle of the header. The width is a real measurement+ * and not a scale — a scaled pane stretches its corners into ovals and drags+ * the writing with them.+ *+ * [progress] is read in `layout`, so opening costs a measure and nothing+ * recomposes.+ */+private fun Modifier.growingFromEnd(progress: () -> Float, from: Dp): Modifier =+ layout { measurable, constraints ->+ val full = constraints.maxWidth+ val start = from.roundToPx().coerceAtMost(full)+ val fraction = progress().coerceIn(0f, 1f)+ val width = (start + (full - start) * fraction).roundToInt().coerceAtLeast(1)+ val placeable = measurable.measure(+ constraints.copy(minWidth = width, maxWidth = width),+ )+ layout(full, placeable.height) { placeable.place(full - width, 0) }+ }++/**+ * A part of the header's capsule that leaves once the page is scrolled.+ *+ * Back and search stay for the whole of the page — one is how you leave and the+ * other is how you find a song in a list too long to read. Keeping the record+ * and the rest of its business are things you do while looking at the top of+ * the page, so they go with the top of the page.+ *+ * Faded *and* taken out of the layout. Alpha alone leaves an invisible control+ * still taking every touch that lands on it, and leaves the capsule the width+ * of three buttons with one button in it.+ *+ * The width goes continuously, which is the whole of the motion. It used to be+ * a switch — full width while the icons faded, then nothing on the frame the+ * travel finished — so the capsule spent the scroll as wide as three buttons+ * with one visible in it and then jumped to a circle. The pane is a piece of+ * glass, and a piece of glass that changes size in one frame reads as two+ * different controls.+ *+ * Both ends over the first [SLOT_TRAVEL] of the header's own travel, the way+ * the bottom bar folds: the part that stops being readable first is the part+ * that goes first, and the capsule has finished closing well before the header+ * has. What is left of the box is cropped from both sides, so the icon is+ * squeezed out of the middle rather than sliding into its neighbour.+ */+@Composable+private fun CollapsingSlot(collapse: () -> Float, content: @Composable () -> Unit) {+ val keep = { (1f - collapse() / SLOT_TRAVEL).coerceIn(0f, 1f) }+ Box(+ Modifier+ .graphicsLayer { alpha = keep() }+ .clipToBounds()+ .layout { measurable, constraints ->+ val placeable = measurable.measure(constraints)+ val width = (placeable.width * keep()).roundToInt()+ if (width <= 0) {+ layout(0, 0) {}+ } else {+ layout(width, placeable.height) {+ placeable.place((width - placeable.width) / 2, 0)+ }+ }+ },+ ) {+ content()+ }+}++/** How much of the header's travel a departing capsule slot uses up. */+private const val SLOT_TRAVEL = 0.45f+/*** What every header becomes once it is scrolled shut.*@@ -1296,52 +1538,29 @@ private fun CollapsedBar(.fillMaxWidth().height(collapsedHeight).padding(top = topPadding)- .padding(horizontal = 6.dp)+ // Wide enough on both sides to clear the glass controls, which stay+ // where they are for the whole of the page rather than handing over+ // to a bar of their own; see below.+ .padding(horizontal = 68.dp).graphicsLayer { alpha = (collapse() * 2f - 1f).coerceIn(0f, 1f) },verticalAlignment = Alignment.CenterVertically,) {- IconButton(onClick = onBack) {- Icon(- PhosphorIcons.Regular.ArrowLeft,- contentDescription = stringResource(R.string.back),- tint = ink,- modifier = Modifier.size(20.dp),- )- }+ // The name, and nothing else.+ //+ // This bar used to grow its own back button, search, shuffle and play+ // as the header shut, and the floating glass ones faded out under them.+ // Two sets of the same controls trading places is a lot of machinery+ // for no gain — and it was the source of a real bug, since a faded+ // control still takes touches. The glass stays; this says where you are.Text(name,style = MaterialTheme.typography.titleMedium,color = ink,maxLines = 1,overflow = TextOverflow.Ellipsis,- modifier = Modifier- .weight(1f)- .padding(horizontal = 6.dp),+ textAlign = TextAlign.Center,+ modifier = Modifier.weight(1f),)- IconButton(onClick = onToggleSearch) {- Icon(- if (searching) PhosphorIcons.Regular.X else PhosphorIcons.Fill.MagnifyingGlass,- contentDescription = stringResource(R.string.search_in_tracks),- tint = ink,- modifier = Modifier.size(18.dp),- )- }- IconButton(onClick = onShuffle) {- Icon(- PhosphorIcons.Bold.Shuffle,- contentDescription = stringResource(R.string.shuffle),- tint = ink,- modifier = Modifier.size(18.dp),- )- }- IconButton(onClick = onPlay) {- Icon(- PhosphorIcons.Fill.Play,- contentDescription = stringResource(R.string.play),- tint = ink,- modifier = Modifier.size(22.dp),- )- }}}diff --git a/app/src/main/java/dev/lelonio/square/ui/player/CanvasSurface.kt b/app/src/main/java/dev/lelonio/square/ui/player/CanvasSurface.ktindex e02a8a0..f077bf1 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/CanvasSurface.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/CanvasSurface.kt@@ -4,6 +4,10 @@ import androidx.compose.runtime.Composableimport androidx.compose.runtime.DisposableEffectimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.remember+import androidx.compose.ui.graphics.Color+import androidx.compose.runtime.setValue+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberUpdatedStateimport androidx.compose.ui.Modifierimport androidx.compose.ui.platform.LocalContext@@ -53,6 +57,17 @@ fun CanvasSurface(* cover used to be. The caller keeps the cover up until this fires.*/onFirstFrame: () -> Unit = {},+ /**+ * The colour the clip's own foot is, read back off the picture.+ *+ * The field the clip dissolves into used to be built from the cover, and a+ * Canvas is very often nothing like its sleeve — a bright clip ending on a+ * dark red field is two pictures meeting, which is the seam this whole+ * treatment exists to avoid. Read slowly and off a thumbnail: a colour that+ * tracked every cut would strobe, and this is meant to read as the light the+ * clip is throwing.+ */+ onTone: (List<Color>) -> Unit = {},) {val context = LocalContext.current@@ -86,6 +101,25 @@ fun CanvasSurface(onDispose { exoPlayer.release() }}+ // The view the picture is actually drawn into, kept so it can be read back.+ var texture by remember(url) { mutableStateOf<android.view.TextureView?>(null) }+ val tone = rememberUpdatedState(onTone)+ LaunchedEffect(texture) {+ val view = texture ?: return@LaunchedEffect+ while (true) {+ if (!view.isAvailable) {+ kotlinx.coroutines.delay(TONE_INTERVAL_MS)+ continue+ }+ val frame = runCatching { view.getBitmap(TONE_SAMPLE, TONE_SAMPLE) }.getOrNull()+ if (frame != null) {+ tone.value(frame.footColumns())+ frame.recycle()+ }+ kotlinx.coroutines.delay(TONE_INTERVAL_MS)+ }+ }+AndroidView(factory = { ctx ->// Cropping to fill and the transparent shutter come from the layout;@@ -94,6 +128,9 @@ fun CanvasSurface(val view = android.view.LayoutInflater.from(ctx).inflate(R.layout.canvas_surface, null) as PlayerViewview.player = exoPlayer+ // PlayerView builds the surface itself from `surface_type`, so the+ // TextureView is found rather than made.+ texture = view.videoSurfaceView as? android.view.TextureViewview},// Nothing here changes with recomposition; the player is swapped by@@ -102,3 +139,64 @@ fun CanvasSurface(modifier = modifier,)}++/**+ * The foot of a frame, as a handful of colours across its width.+ *+ * Not one average. What a still cover does below its own edge is carry its last+ * row downwards, so a red shape at the bottom of the picture goes on being red+ * under it while a dark corner stays dark. One colour for the whole width+ * throws exactly that away — a frame with a red flood across the middle and+ * black at the sides would come out an even maroon. These are column averages+ * of the bottom band, which the field below paints as a gradient across.+ *+ * The band, not the whole frame: what the fade meets is the foot of the+ * picture, and a clip whose top half is a bright sky and whose bottom is a dark+ * street averages to neither.+ */+private fun android.graphics.Bitmap.footColumns(): List<Color> {+ val from = (height * 0.72f).toInt().coerceIn(0, height - 1)+ val band = (height - from).coerceAtLeast(1)+ val step = (width / TONE_COLUMNS).coerceAtLeast(1)+ return (0 until TONE_COLUMNS).map { column ->+ val x0 = (column * step).coerceAtMost(width - 1)+ val x1 = (x0 + step).coerceAtMost(width)+ var r = 0L+ var g = 0L+ var b = 0L+ var count = 0+ for (y in from until height) {+ for (x in x0 until x1) {+ val pixel = getPixel(x, y)+ r += android.graphics.Color.red(pixel)+ g += android.graphics.Color.green(pixel)+ b += android.graphics.Color.blue(pixel)+ count+++ }+ }+ if (count == 0) Color.Black+ else Color(r / count / 255f, g / count / 255f, b / count / 255f)+ }.also { require(band > 0) }+}++/**+ * How many columns the foot is read as.+ *+ * Eight kept the shape and showed the machinery: a gradient interpolates+ * straight between its stops, so eight of them across a phone is a stop every+ * 45 points and the eye finds each one — the field came out as vertical bands.+ * Twenty-four is one every fifteen points, which reads as a wash.+ */+private const val TONE_COLUMNS = 24++/** How often the clip is read back, in milliseconds. */+private const val TONE_INTERVAL_MS = 900L++/**+ * Side of the thumbnail the colours are taken from.+ *+ * Wide enough that each of the columns above still averages several pixels+ * rather than reading one, which is the difference between a colour and a+ * speck.+ */+private const val TONE_SAMPLE = 96diff --git a/app/src/main/java/dev/lelonio/square/ui/player/FloatingMiniPlayer.kt b/app/src/main/java/dev/lelonio/square/ui/player/FloatingMiniPlayer.ktindex 34c255a..e49d3aa 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/FloatingMiniPlayer.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/FloatingMiniPlayer.kt@@ -56,6 +56,7 @@ import androidx.compose.ui.unit.dpimport androidx.compose.ui.unit.spimport com.adamglin.PhosphorIconsimport com.adamglin.phosphoricons.Fill+import com.adamglin.phosphoricons.fill.Devicesimport com.adamglin.phosphoricons.fill.Pauseimport com.adamglin.phosphoricons.fill.Playimport com.adamglin.phosphoricons.fill.SkipForward@@ -83,6 +84,14 @@ fun FloatingMiniPlayer(positionMs: State<Long>,modifier: Modifier = Modifier,contentColor: androidx.compose.ui.graphics.Color = MiniPlayerInk,+ /**+ * Where the music is coming out, when it is not this phone.+ *+ * Takes the artist's place on the second line, the way the old bar did it:+ * with playback on a speaker in another room, whose record it is matters+ * less than which room, and the screen was saying nothing about it at all.+ */+ remoteLabel: String? = null,/** Folded: the strip has room for the song and one button, nothing else. */inline: Boolean = false,onClick: () -> Unit,@@ -198,17 +207,34 @@ fun FloatingMiniPlayer(maxLines = 1,overflow = TextOverflow.Ellipsis,)- Text(- text = state.artist,- style = if (inline) {- MaterialTheme.typography.bodySmall.copy(fontSize = 10.sp)- } else {- MaterialTheme.typography.bodySmall- },- color = contentColor.copy(alpha = 0.7f),- maxLines = 1,- overflow = TextOverflow.Ellipsis,- )+ Row(verticalAlignment = Alignment.CenterVertically) {+ if (remoteLabel != null) {+ Icon(+ PhosphorIcons.Fill.Devices,+ contentDescription = null,+ tint = MiniPlayerAccent,+ modifier = Modifier+ .size(if (inline) 10.dp else 12.dp)+ .padding(end = 0.dp),+ )+ }+ Text(+ text = remoteLabel ?: state.artist,+ style = if (inline) {+ MaterialTheme.typography.bodySmall.copy(fontSize = 10.sp)+ } else {+ MaterialTheme.typography.bodySmall+ },+ color = if (remoteLabel != null) {+ MiniPlayerAccent+ } else {+ contentColor.copy(alpha = 0.7f)+ },+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ modifier = Modifier.padding(start = if (remoteLabel != null) 4.dp else 0.dp),+ )+ }}// Skip first and play second, which is the order asked for: thediff --git a/app/src/main/java/dev/lelonio/square/ui/player/MiniPlayer.kt b/app/src/main/java/dev/lelonio/square/ui/player/MiniPlayer.ktindex 29c5733..fc8aa94 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/MiniPlayer.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/MiniPlayer.kt@@ -305,7 +305,7 @@ internal val MiniPlayerInkDim: Color* and inventing a colour for it would be asking people to learn a private* signal for something they already recognise.*/-private val MiniPlayerAccent = Color(0xFF1ED760)+internal val MiniPlayerAccent = Color(0xFF1ED760)/** Guarded against the duration being unknown while a track loads. */fun progressOf(positionMs: Long, durationMs: Long): Float =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 2547885..246cad0 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@@ -68,6 +68,8 @@ import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.CompositingStrategyimport androidx.compose.ui.graphics.BlendModeimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.Shadow+import androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.graphics.graphicsLayerimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.layout.ContentScale@@ -158,6 +160,25 @@ private const val CANVAS_HANDOVER = 500/** The shape the catalogue files an extended cover in: three by four. */private const val DETAIL_ASPECT = 3f / 4f+/**+ * Where a Canvas stops being a picture, in its own slot's terms.+ *+ * The same shape as the cover's fade — see HeroBackdrop's `softening` — written+ * out here because a clip is drawn by a different path and there is nothing to+ * share but the numbers. Eased rather than straight: a linear ramp has a corner+ * at each end, and a corner across a moving picture is a band.+ */+private val CLIP_FADE: Array<Pair<Float, Color>> = run {+ val from = 0.82f+ val to = 0.97f+ val steps = 8+ Array(steps + 1) { index ->+ val t = index.toFloat() / steps+ val eased = t * t * (3f - 2f * t)+ (from + (to - from) * t) to Color.Black.copy(alpha = 1f - eased)+ }+}+/** How long each half of a change between the cover and a panel takes. */private const val STAGE_FADE_MS = 180@@ -222,6 +243,15 @@ fun PlayerScreen(*//** The colours the catalogue filed with this artwork; see CoverAura. */catalogPalette: List<String> = emptyList(),+ /**+ * The foot of the Canvas, across its width, as it plays.+ *+ * The field this player sits on is built from the cover, and a Canvas is+ * very often nothing like its sleeve: the clip faded into a colour that was+ * not in it. Empty whenever no clip is showing, which puts the cover's own+ * colours back.+ */+ onClipColumns: (List<Color>) -> Unit = {},coverHeroUrl: String? = null,/** And the moving version of it, for the records that have one. */coverMotionUrl: String? = null,@@ -380,6 +410,12 @@ fun PlayerScreen(var ambient by remember { mutableStateOf<AmbientEdges?>(null) }LaunchedEffect(videoOn) { if (!videoOn) ambient = null }+ // Nothing of the last clip left behind on a track with no Canvas.+ val clipReport = androidx.compose.runtime.rememberUpdatedState(onClipColumns)+ LaunchedEffect(canvas?.url, canvas?.isVideo) {+ if (canvas?.isVideo != true) clipReport.value(emptyList())+ }+val readPalette by dev.lelonio.square.ui.theme.rememberArtworkPalette(state.artworkUrl.takeIf { canvas == null },)@@ -573,6 +609,30 @@ fun PlayerScreen(label = "clipAlpha",)+ // The clip takes the cover's place rather than the screen's.+ //+ // Full-bleed, a Canvas ran under the title, the transport and the+ // tab bar — every one of them a pane of glass, and glass over a+ // bright, moving, ungraded picture is not readable at any tint. The+ // page already knows how to end a picture: the cover sits in this+ // slot and dissolves into a blurred field made of itself. A clip is+ // a cover that moves, so it goes in the same slot and gets the same+ // ending, and the controls sit on the field the way they do for+ // every other track.+ Box(+ Modifier+ .fillMaxWidth()+ .aspectRatio(DETAIL_ASPECT)+ .align(Alignment.TopCenter)+ .graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen }+ .drawWithContent {+ drawContent()+ drawRect(+ brush = Brush.verticalGradient(*CLIP_FADE),+ blendMode = BlendMode.DstIn,+ )+ },+ ) {Crossfade(targetState = canvas,animationSpec = tween(500),@@ -597,6 +657,18 @@ fun PlayerScreen(url = clip.url,isPlaying = state.isPlaying,onFirstFrame = { canvasReady = true },+ // Only while this clip is still the one playing.+ //+ // A Crossfade keeps the outgoing content alive for the+ // length of the fade, and a Canvas that is leaving goes+ // on reading itself for those few hundred milliseconds.+ // Its last report landed *after* the track change had+ // emptied the field, so a song with no clip of its own+ // kept the previous one's colours — there was nothing+ // left to clear them again.+ onTone = { columns ->+ if (clip.url == canvas?.url) onClipColumns(columns)+ },modifier = Modifier.fillMaxSize(),)@@ -655,6 +727,7 @@ fun PlayerScreen(},)}+ }}CompositionLocalProvider(LocalContentColor provides GlassInk) {@@ -1486,9 +1559,26 @@ private fun TopBar(// being shown: the panel names above it are labels for what is on// screen already.val open = onOpenSource.takeIf { panel == PlayerPanel.NONE && source.isNotBlank() }+ // Light, with a shadow, whichever way the phone is set.+ //+ // This line is the only text on the player with nothing behind it+ // but the picture — the title and the transport sit on the field+ // below the fade, and the buttons beside it have their own glass.+ // Following the theme put black letters straight onto a Canvas in+ // the light setting, and pausing made it worse, since the veil that+ // dims a stopped clip was then darkening the very thing those+ // letters needed to be lighter than. A photograph has no side to+ // be on: what works over one is light type with a shadow under it.Text(title,- style = MaterialTheme.typography.titleMedium,+ style = MaterialTheme.typography.titleMedium.copy(+ shadow = Shadow(+ color = Color.Black.copy(alpha = 0.55f),+ offset = Offset(0f, 1f),+ blurRadius = 14f,+ ),+ ),+ color = Color.White,textAlign = TextAlign.Center,modifier = Modifier.fillMaxWidth()diff --git a/app/src/main/java/dev/lelonio/square/ui/player/PlayerState.kt b/app/src/main/java/dev/lelonio/square/ui/player/PlayerState.ktindex c7e2a73..8c0b08a 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/PlayerState.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/PlayerState.kt@@ -101,6 +101,16 @@ fun dev.lelonio.square.data.RemotePlayback.asPlaybackState(on: String) = Playbacartist = artist,artworkUrl = coverUrl.ifEmpty { null },isPlaying = playing,+ // The intent as well as the fact.+ //+ // Every glyph on this screen follows `wantsPlay`, because locally that is+ // what a tap changes and what the listener should see change. A remote+ // playback left it at its default, so music playing in another room drew a+ // play button on a moving progress bar: the bar followed the fact and the+ // button followed an intent nobody had set. On another device the two are+ // the same thing — there is no buffering to ride out here, only what that+ // device is doing.+ wantsPlay = playing,durationMs = durationMs,hasNext = true,hasPrevious = true,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 7f7f76e..7b2d85d 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@@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.heightimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.rememberLazyListStateimport androidx.compose.foundation.lazy.LazyListScopeimport androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.items@@ -23,6 +24,7 @@ import androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Textimport androidx.compose.foundation.text.BasicTextFieldimport androidx.compose.runtime.Composable+import androidx.compose.runtime.derivedStateOfimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOf@@ -93,7 +95,7 @@ fun SearchScreen(* Shown in place of the prompt on an empty box, which is where a list of* things somebody already wanted belongs.*/- history: List<CatalogTrack>,+ history: List<dev.lelonio.square.data.SearchHistoryEntry>,onClearHistory: () -> Unit,/** No connection: the catalogue cannot be searched at all. */offline: Boolean = false,@@ -110,6 +112,8 @@ fun SearchScreen(* is also where every other client puts it.*/onQuery: (String) -> Unit,+ /** Asked for as the list nears its end; see MainViewModel.loadMoreSearch. */+ onLoadMore: () -> Unit = {},backdrop: Backdrop,) {var kind by remember { mutableStateOf(Kind.ALL) }@@ -118,7 +122,30 @@ fun SearchScreen(val query = state.queryremember(query) { kind = Kind.ALL }- LazyColumn(Modifier.fillMaxSize(), contentPadding = contentPadding) {+ val listState = rememberLazyListState()++ // Another page as the end comes into view, not on a button.+ //+ // Twenty of each kind is the page every client asks for and a fine first+ // answer, but a search for a name a hundred records share stopped dead at+ // twenty. Watching the last few rows rather than the very last means the+ // next page is usually there before the reader arrives at it.+ val nearEnd by remember {+ derivedStateOf {+ val info = listState.layoutInfo+ val last = info.visibleItemsInfo.lastOrNull()?.index ?: return@derivedStateOf false+ info.totalItemsCount > 0 && last >= info.totalItemsCount - LOAD_AHEAD+ }+ }+ LaunchedEffect(nearEnd, state.query, state.results.count) {+ if (nearEnd && !state.loading && !state.loadingMore && !state.exhausted) onLoadMore()+ }++ LazyColumn(+ Modifier.fillMaxSize(),+ state = listState,+ contentPadding = contentPadding,+ ) {// No field here: it is in the bar, where the search button grows into// it. A page that answers a query by drawing a second box asks which of// the two is listening.@@ -162,22 +189,71 @@ fun SearchScreen(key = { "history-${history[it].uri}" },contentType = { "track" },) { index ->- val track = history[index]- SwipeToQueue(onQueue = { onEnqueue(track) }) {+ val entry = history[index]+ val track = entry.track+ if (track != null) {+ // The songs among them are the queue, as a playlist+ // would be: playing the third leaves the two after it to+ // follow. The rows that are not songs are skipped in+ // that count rather than played.+ val songs = remember(history) { history.mapNotNull { it.track } }+ val at = remember(history, entry.uri) {+ songs.indexOfFirst { it.uri == entry.uri }.coerceAtLeast(0)+ }+ SwipeToQueue(onQueue = { onEnqueue(track) }) {+ ResultRow(+ title = track.name,+ subtitle = track.artist,+ artworkUrl = track.artworkUrl,+ highlighted = track.uri == nowPlayingUri,+ round = false,+ onClick = { onPlayTrack(songs, at) },+ onMenu = { onTrackMenu(track) },+ )+ }+ } else {+ // An artist, a record or a list: the row opens its page,+ // which is what it did when it was found.ResultRow(- title = track.name,- subtitle = track.artist,- artworkUrl = track.artworkUrl,- highlighted = track.uri == nowPlayingUri,- round = false,- // The list itself is the queue, as a playlist would- // be: playing the third song leaves the two after it- // to follow.- onClick = { onPlayTrack(history, index) },- onMenu = { onTrackMenu(track) },+ 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+ // looking: at the bottom, where they ran out of rows.+ if (state.loadingMore) {+ item(contentType = "more") {+ Box(+ Modifier+ .fillMaxWidth()+ .padding(vertical = 18.dp),+ contentAlignment = Alignment.Center,+ ) {+ CircularProgressIndicator(+ strokeWidth = 2.dp,+ modifier = Modifier.size(22.dp),+ )+ }+ }+ }+item(contentType = "tail") { Box(Modifier.height(24.dp)) }}@@ -228,6 +304,24 @@ fun SearchScreen(section(R.string.playlists, state.results.playlists, all, round = false, onOpenContext)}+ // The page on its way, said in the one place the reader is+ // looking: at the bottom, where they ran out of rows.+ if (state.loadingMore) {+ item(contentType = "more") {+ Box(+ Modifier+ .fillMaxWidth()+ .padding(vertical = 18.dp),+ contentAlignment = Alignment.Center,+ ) {+ CircularProgressIndicator(+ strokeWidth = 2.dp,+ modifier = Modifier.size(22.dp),+ )+ }+ }+ }+item(contentType = "tail") { Box(Modifier.height(24.dp)) }}}@@ -243,22 +337,11 @@ private fun KindRow(selected: Kind, backdrop: Backdrop, onSelect: (Kind) -> Unitmodifier = Modifier.padding(top = 16.dp, bottom = 4.dp),) {items(Kind.entries.toList(), key = { it.name }) { entry ->- val isSelected = entry == selected- LiquidButton(+ dev.lelonio.square.ui.components.FilterChip(+ label = stringResource(entry.label),+ selected = entry == selected,onClick = { onSelect(entry) },- backdrop = backdrop,- flat = true,- contentHeight = 38.dp,- contentPadding = 18.dp,- surfaceColor = if (isSelected) SelectedFilm else Color.Unspecified,- wash = dev.lelonio.square.ui.glass.chipWash(isSelected),- ) {- Text(- stringResource(entry.label),- style = MaterialTheme.typography.bodyMedium,- color = if (isSelected) Ink else InkDim,- )- }+ )}}}@@ -453,3 +536,6 @@ private val BadgeFilm = androidx.compose.ui.graphics.Color.White.copy(alpha = 0.* belongs, but the page they sit on should be worth scrolling first.*/private const val TOP_RESULTS = 8++/** How many rows from the end the next page is asked for. */+private const val LOAD_AHEAD = 6diff --git a/app/src/main/java/dev/lelonio/square/ui/settings/GlassSettings.kt b/app/src/main/java/dev/lelonio/square/ui/settings/GlassSettings.ktindex d2985b3..5ebdd18 100644--- a/app/src/main/java/dev/lelonio/square/ui/settings/GlassSettings.kt+++ b/app/src/main/java/dev/lelonio/square/ui/settings/GlassSettings.kt@@ -101,13 +101,6 @@ fun GlassSection(backdrop: Backdrop) {selected = entry == profile,) { store.setProfile(entry) }}- SettingsDivider()- Text(- stringResource(profile.note),- style = MaterialTheme.typography.bodySmall,- color = InkDim,- modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp),- )SettingsDivider()GlassPreview(config = config, backdrop = backdrop)@@ -217,7 +210,6 @@ fun GlassSection(backdrop: Backdrop) {SettingsDivider()GlassSwitch(label = stringResource(R.string.glass_dispersion),- note = stringResource(R.string.glass_dispersion_note),checked = config.chromaticAberration,backdrop = backdrop,onChange = store::setChromaticAberration,@@ -225,7 +217,6 @@ fun GlassSection(backdrop: Backdrop) {SettingsDivider()GlassSwitch(label = stringResource(R.string.glass_depth),- note = stringResource(R.string.glass_depth_note),checked = config.depthEffect,backdrop = backdrop,onChange = store::setDepthEffect,@@ -239,7 +230,6 @@ fun GlassSection(backdrop: Backdrop) {SettingsDivider()GlassSwitch(label = stringResource(R.string.glass_where_bar),- note = null,checked = config.navBarEnabled,backdrop = backdrop,onChange = store::setNavBarEnabled,@@ -247,7 +237,6 @@ fun GlassSection(backdrop: Backdrop) {SettingsDivider()GlassSwitch(label = stringResource(R.string.glass_where_mini_player),- note = null,checked = config.miniPlayerEnabled,backdrop = backdrop,onChange = store::setMiniPlayerEnabled,@@ -255,7 +244,6 @@ fun GlassSection(backdrop: Backdrop) {SettingsDivider()GlassSwitch(label = stringResource(R.string.glass_where_player),- note = null,checked = config.playerEnabled,backdrop = backdrop,onChange = store::setPlayerEnabled,@@ -265,7 +253,6 @@ fun GlassSection(backdrop: Backdrop) {SettingsDivider()GlassSwitch(label = stringResource(R.string.bar_folds),- note = stringResource(R.string.bar_folds_note),checked = folds,backdrop = backdrop,onChange = store::setBarFolds,@@ -525,7 +512,6 @@ private fun GlassSlider(@Composableprivate fun GlassSwitch(label: String,- note: String?,checked: Boolean,backdrop: Backdrop,onChange: (Boolean) -> Unit,@@ -540,9 +526,6 @@ private fun GlassSwitch() {Column(Modifier.weight(1f)) {Text(label, style = MaterialTheme.typography.bodyLarge)- if (note != null) {- Text(note, style = MaterialTheme.typography.bodySmall, color = InkDim)- }}LiquidToggle(selected = { checked },diff --git a/app/src/main/java/dev/lelonio/square/ui/settings/SettingsScreen.kt b/app/src/main/java/dev/lelonio/square/ui/settings/SettingsScreen.ktindex 9ebef05..c4e0201 100644--- a/app/src/main/java/dev/lelonio/square/ui/settings/SettingsScreen.kt+++ b/app/src/main/java/dev/lelonio/square/ui/settings/SettingsScreen.kt@@ -501,13 +501,6 @@ private fun BackendSection() {selected = backend == chosen,) { store.setBackend(backend) }}- RowDivider()- Text(- stringResource(R.string.backend_note),- style = MaterialTheme.typography.bodySmall,- color = InkDim,- modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp),- )}}@@ -551,13 +544,6 @@ private fun YouTubeAccountSection(onSignIn: () -> Unit, onChannelChange: () -> Uselected = false,onClick = onSignIn,)- RowDivider()- Text(- stringResource(R.string.youtube_sign_in_note),- style = MaterialTheme.typography.bodySmall,- color = InkDim,- modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp),- )} else {Row(Modifier@@ -647,7 +633,6 @@ private fun CanvasSection(backdrop: Backdrop) {Section(stringResource(R.string.canvas)) {DownloadSwitch(label = stringResource(R.string.canvas_show),- note = stringResource(R.string.canvas_note),checked = enabled,backdrop = backdrop,onChange = store::setCanvasEnabled,@@ -671,13 +656,6 @@ private fun EffectQualitySection() {selected = quality == chosen,) { store.set(quality) }}- RowDivider()- Text(- stringResource(chosen.note),- style = MaterialTheme.typography.bodySmall,- color = InkDim,- modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp),- )}}@@ -703,8 +681,7 @@ private fun CrossfadeSection() {}RowDivider()Text(- stringResource(R.string.crossfade_note) + " " +- stringResource(R.string.quality_restarts),+ stringResource(R.string.quality_restarts),style = MaterialTheme.typography.bodySmall,color = InkDim,modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp),@@ -744,8 +721,7 @@ private fun QualitySection() {}RowDivider()Text(- stringResource(R.string.quality_auto_note) + " " +- stringResource(R.string.quality_restarts),+ stringResource(R.string.quality_restarts),style = MaterialTheme.typography.bodySmall,color = InkDim,modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp),@@ -931,17 +907,10 @@ private fun DownloadsSection(backdrop: Backdrop) {selected = entry == quality,) { settings.setQuality(entry) }}- Text(- stringResource(R.string.download_quality_note),- style = MaterialTheme.typography.bodySmall,- color = InkDim,- modifier = Modifier.padding(horizontal = 18.dp, vertical = 10.dp),- )RowDivider()DownloadSwitch(label = stringResource(R.string.download_wifi_only),- note = stringResource(R.string.download_wifi_only_note),checked = wifiOnly,backdrop = backdrop,onChange = settings::setWifiOnly,@@ -950,7 +919,6 @@ private fun DownloadsSection(backdrop: Backdrop) {RowDivider()DownloadSwitch(label = stringResource(R.string.offline_mode),- note = stringResource(R.string.offline_mode_note),checked = offline,backdrop = backdrop,onChange = settings::setOfflineMode,@@ -999,7 +967,6 @@ private fun DownloadsSection(backdrop: Backdrop) {@Composableprivate fun DownloadSwitch(label: String,- note: String?,checked: Boolean,backdrop: Backdrop,onChange: (Boolean) -> Unit,@@ -1012,12 +979,7 @@ private fun DownloadSwitch(verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.spacedBy(12.dp),) {- Column(Modifier.weight(1f)) {- Text(label, style = MaterialTheme.typography.bodyLarge)- if (note != null) {- Text(note, style = MaterialTheme.typography.bodySmall, color = InkDim)- }- }+ Text(label, style = MaterialTheme.typography.bodyLarge, modifier = Modifier.weight(1f))dev.lelonio.square.ui.glass.LiquidToggle(selected = { checked },onSelect = onChange,diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xmlindex 0b802b1..01474b0 100644--- a/app/src/main/res/values-de/strings.xml+++ b/app/src/main/res/values-de/strings.xml@@ -400,4 +400,5 @@<string name="canvas_note">Das kurze Video, das manche Titel mitbringen. Aus wird es auch nicht geladen.</string><string name="show_all">Alle anzeigen</string><string name="show_less">Weniger anzeigen</string>+ <string name="search_library">Bibliothek durchsuchen</string></resources>diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xmlindex 9b7ce32..49a087b 100644--- a/app/src/main/res/values-es/strings.xml+++ b/app/src/main/res/values-es/strings.xml@@ -400,4 +400,5 @@<string name="canvas_note">El vídeo corto que traen algunas canciones. Desactivado, tampoco se descarga.</string><string name="show_all">Mostrar todo</string><string name="show_less">Mostrar menos</string>+ <string name="search_library">Buscar en tu biblioteca</string></resources>diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xmlindex deff340..d60757d 100644--- a/app/src/main/res/values-fr/strings.xml+++ b/app/src/main/res/values-fr/strings.xml@@ -400,4 +400,5 @@<string name="canvas_note">La courte vidéo que portent certains titres. Désactivé, elle n\'est pas téléchargée non plus.</string><string name="show_all">Tout afficher</string><string name="show_less">Afficher moins</string>+ <string name="search_library">Rechercher dans la bibliothèque</string></resources>diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xmlindex 1e7ae40..ba16d36 100644--- a/app/src/main/res/values-hi/strings.xml+++ b/app/src/main/res/values-hi/strings.xml@@ -415,4 +415,5 @@<string name="canvas_note">कुछ गानों के साथ आने वाला छोटा वीडियो. बंद होने पर डाउनलोड भी नहीं होता.</string><string name="show_all">सभी दिखाएँ</string><string name="show_less">कम दिखाएँ</string>+ <string name="search_library">लाइब्रेरी में खोजें</string></resources>diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xmlindex 35e30c2..647966b 100644--- a/app/src/main/res/values-it/strings.xml+++ b/app/src/main/res/values-it/strings.xml@@ -401,4 +401,5 @@<string name="canvas_note">Il breve video che alcuni brani portano con sé. Disattivato, non viene nemmeno scaricato.</string><string name="show_all">Mostra tutto</string><string name="show_less">Mostra meno</string>+ <string name="search_library">Cerca nella libreria</string></resources>diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xmlindex c328144..9ea1839 100644--- a/app/src/main/res/values-pt/strings.xml+++ b/app/src/main/res/values-pt/strings.xml@@ -400,4 +400,5 @@<string name="canvas_note">O vídeo curto que algumas faixas trazem. Desligado, também não é baixado.</string><string name="show_all">Mostrar tudo</string><string name="show_less">Mostrar menos</string>+ <string name="search_library">Pesquisar na biblioteca</string></resources>diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xmlindex 3297c1f..2b9746a 100644--- a/app/src/main/res/values-tr/strings.xml+++ b/app/src/main/res/values-tr/strings.xml@@ -414,4 +414,5 @@<string name="canvas_note">Bazı şarkıların getirdiği kısa video. Kapalıyken indirilmez de.</string><string name="show_all">Tümünü göster</string><string name="show_less">Daha az göster</string>+ <string name="search_library">Kitaplıkta ara</string></resources>diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex f35477e..6ecc31f 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -421,4 +421,5 @@<string name="canvas_note">The short video some tracks come with. Off, none is downloaded either.</string><string name="show_all">Show all</string><string name="show_less">Show less</string>+ <string name="search_library">Search your library</string></resources>