Skip to content

Commit

Permalink
Merge pull request #3908 from KyNarec/master
Browse files Browse the repository at this point in the history
Search Results Query are clickable and editable
  • Loading branch information
fast4x authored Oct 9, 2024
2 parents f35c500 + cb191db commit 53ef380
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ fun AppNavigation(
) {
val navigateToAlbum =
{ browseId: String -> navController.navigate(route = "${NavRoutes.album.name}/$browseId") }
val navigateToArtist = { browseId: String -> navController.navigate("${NavRoutes.artist.name}/$browseId") }
val navigateToPlaylist = { browseId: String -> navController.navigate("${NavRoutes.playlist.name}/$browseId") }
val navigateToArtist =
{ browseId: String -> navController.navigate("${NavRoutes.artist.name}/$browseId") }
val navigateToPlaylist =
{ browseId: String -> navController.navigate("${NavRoutes.playlist.name}/$browseId") }
val pop = {
if (navController.currentBackStackEntry?.lifecycle?.currentState == Lifecycle.State.RESUMED) navController.popBackStack()
}
Expand Down Expand Up @@ -253,12 +255,12 @@ fun AppNavigation(
)
) { navBackStackEntry ->
val id = navBackStackEntry.arguments?.getString("id") ?: ""
ArtistScreen(
navController = navController,
browseId = id,
playerEssential = playerEssential,
)
}
ArtistScreen(
navController = navController,
browseId = id,
playerEssential = playerEssential,
)
}

composable(
route = "${NavRoutes.album.name}/{id}",
Expand Down Expand Up @@ -314,12 +316,12 @@ fun AppNavigation(
}

composable(route = NavRoutes.settings.name) {
SettingsScreen(
navController = navController,
playerEssential = playerEssential,
//pop = popDestination,
//onGoToSettingsPage = { index -> navController.navigate("settingsPage/$index") }
)
SettingsScreen(
navController = navController,
playerEssential = playerEssential,
//pop = popDestination,
//onGoToSettingsPage = { index -> navController.navigate("settingsPage/$index") }
)
}

composable(route = NavRoutes.statistics.name) {
Expand All @@ -335,7 +337,7 @@ fun AppNavigation(
navController = navController,
playerEssential = playerEssential,

)
)
}

/*
Expand Down Expand Up @@ -382,7 +384,13 @@ fun AppNavigation(
//pop = popDestination,
onSearch = { query ->
println("onSearch: $query")
navController.navigate(route = "${NavRoutes.searchResults.name}/${cleanString(query)}")
navController.navigate(
route = "${NavRoutes.searchResults.name}/${
cleanString(
query
)
}"
)

if (!context.preferences.getBoolean(pauseSearchHistoryKey, false)) {
it.fast4x.rimusic.query {
Expand All @@ -391,7 +399,7 @@ fun AppNavigation(
}
},

)
)
}

composable(
Expand Down Expand Up @@ -481,7 +489,7 @@ fun AppNavigation(
composable(
route = NavRoutes.onDevice.name
) { navBackStackEntry ->
DeviceListSongsScreen(
DeviceListSongsScreen(
navController = navController,
deviceLists = DeviceLists.LocalSongs,
playerEssential = playerEssential,
Expand All @@ -497,5 +505,26 @@ fun AppNavigation(
)
}

composable(
"searchScreenRoute/{query}"
) { backStackEntry ->
val context = LocalContext.current
val query = backStackEntry.arguments?.getString("query")?: ""
SearchScreen(
navController = navController,
playerEssential = playerEssential,
initialTextInput = query ,
onViewPlaylist = {},
onSearch = { newQuery ->
navController.navigate(route = "${NavRoutes.searchResults.name}/${cleanString(newQuery)}")

if (!context.preferences.getBoolean(pauseSearchHistoryKey, false)) {
it.fast4x.rimusic.query {
Database.insert(SearchQuery(query = newQuery))
}
}
},
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,13 @@ fun SearchResultScreen(
modifier = Modifier
.pointerInput(Unit) {
detectTapGestures {
/*
context.persistMap?.keys?.removeAll {
it.startsWith("searchResults/$query/")
it.startsWith("searchResults/$query/")
}
onSearchAgain()
*/
navController.navigate("searchScreenRoute/${query}")
}
}
)
Expand Down

0 comments on commit 53ef380

Please sign in to comment.