Modern Apps git

← Modern-Apps.git

music: fix song page "goto"

Commit
483a90201fdddb791a6d8c246a618f2e57c55ac1
Author
Vayun Mathur <[email protected]>
When
2026-05-05 19:08 UTC (7 months ago)
Parents
ee74b2f

Diff

music/src/main/java/com/vayunmathur/music/ui/SongScreen.kt
diff --git a/music/src/main/java/com/vayunmathur/music/ui/SongScreen.kt b/music/src/main/java/com/vayunmathur/music/ui/SongScreen.ktindex 4c84fdd49b..3c726e56e5 100644--- a/music/src/main/java/com/vayunmathur/music/ui/SongScreen.kt+++ b/music/src/main/java/com/vayunmathur/music/ui/SongScreen.kt@@ -90,23 +90,22 @@ fun SongScreen(backStack: NavBackStack<Route>) {                 actions = {                     if (currentSource != null && currentSourceName != null) {                         TextButton(onClick = {-                            val route = when {-                                currentSource == "all_songs" -> Route.Home-                                currentSource!!.startsWith("album_") -> Route.AlbumDetail(currentSource!!.removePrefix("album_").toLong())-                                currentSource!!.startsWith("playlist_") -> Route.PlaylistDetail(currentSource!!.removePrefix("playlist_").toLong())-                                currentSource!!.startsWith("artist_") -> Route.ArtistDetail(currentSource!!.removePrefix("artist_").toLong())-                                else -> null-                            }-                            if (route != null) {-                                backStack.clear()-                                backStack.add(route)-                                if (route != Route.Home && route != Route.Song) {-                                    // if it's a detail page, we might want to be able to go back to home?-                                    // MainNavigation handles the backstack. -                                    // clear() then add(Home) then add(detail) would be better?-                                    // But clear() removes everything.+                            when {+                                currentSource == "all_songs" -> {+                                    backStack.reset(Route.Home)+                                }+                                currentSource!!.startsWith("album_") -> {+                                    val id = currentSource!!.removePrefix("album_").toLong()+                                    backStack.reset(Route.Home, Route.Albums, Route.AlbumDetail(id))+                                }+                                currentSource!!.startsWith("playlist_") -> {+                                    val id = currentSource!!.removePrefix("playlist_").toLong()+                                    backStack.reset(Route.Home, Route.Playlists, Route.PlaylistDetail(id))+                                }+                                currentSource!!.startsWith("artist_") -> {+                                    val id = currentSource!!.removePrefix("artist_").toLong()+                                    backStack.reset(Route.Home, Route.Artists, Route.ArtistDetail(id))                                 }-                                // Let's just add it for now.                             }                         }) {                             Text(