mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
address feedback: focus detail screens anywhere in the stack, brighter sheet
- navigateDetail scans the whole back stack and pops back to a matching album/artist/ playlist, not just the top, so artist -> album -> now playing -> view artist focuses the existing artist instead of pushing a second one - raise the sheet container to surfaceContainerHigh so it reads against the background behind it
This commit is contained in:
@@ -52,6 +52,7 @@ import androidx.lifecycle.ViewModelStoreOwner
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
@@ -187,9 +188,18 @@ private fun MainNavigation() {
|
||||
value: String,
|
||||
route: String,
|
||||
) {
|
||||
val top = navController.currentBackStackEntry
|
||||
if (top?.destination?.route == pattern && top.arguments?.getString(argument) == value) return
|
||||
navController.navigate(route)
|
||||
val matches: (NavBackStackEntry?) -> Boolean = { entry ->
|
||||
entry?.destination?.route == pattern && entry.arguments?.getString(argument) == value
|
||||
}
|
||||
if (matches(navController.currentBackStackEntry)) return
|
||||
if (navController.currentBackStack.value.none(matches)) {
|
||||
navController.navigate(route)
|
||||
return
|
||||
}
|
||||
var guard = navController.currentBackStack.value.size
|
||||
while (guard-- > 0 && !matches(navController.currentBackStackEntry) && navController.popBackStack()) {
|
||||
// pop until the matching entry is back on top
|
||||
}
|
||||
}
|
||||
LaunchedEffect(Unit) { playbackController.connect() }
|
||||
LaunchedEffect(Unit) { if (nowPlayingOpen) nowPlayingProgress = 1f }
|
||||
|
||||
@@ -141,6 +141,7 @@ fun ItemContextMenu(
|
||||
onDismissRequest = { dismiss() },
|
||||
sheetState = sheetState,
|
||||
dragHandle = null,
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
) {
|
||||
MenuHeader(target)
|
||||
when (target) {
|
||||
|
||||
@@ -528,6 +528,7 @@ fun LibraryScreen(
|
||||
ModalBottomSheet(
|
||||
onDismissRequest = { showOptions = false },
|
||||
dragHandle = null,
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
) {
|
||||
ListOptionsSheet(
|
||||
listQuery = listQuery,
|
||||
|
||||
Reference in New Issue
Block a user