mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +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.compose.collectAsStateWithLifecycle
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
||||||
|
import androidx.navigation.NavBackStackEntry
|
||||||
import androidx.navigation.NavType
|
import androidx.navigation.NavType
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
@@ -187,9 +188,18 @@ private fun MainNavigation() {
|
|||||||
value: String,
|
value: String,
|
||||||
route: String,
|
route: String,
|
||||||
) {
|
) {
|
||||||
val top = navController.currentBackStackEntry
|
val matches: (NavBackStackEntry?) -> Boolean = { entry ->
|
||||||
if (top?.destination?.route == pattern && top.arguments?.getString(argument) == value) return
|
entry?.destination?.route == pattern && entry.arguments?.getString(argument) == value
|
||||||
navController.navigate(route)
|
}
|
||||||
|
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) { playbackController.connect() }
|
||||||
LaunchedEffect(Unit) { if (nowPlayingOpen) nowPlayingProgress = 1f }
|
LaunchedEffect(Unit) { if (nowPlayingOpen) nowPlayingProgress = 1f }
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ fun ItemContextMenu(
|
|||||||
onDismissRequest = { dismiss() },
|
onDismissRequest = { dismiss() },
|
||||||
sheetState = sheetState,
|
sheetState = sheetState,
|
||||||
dragHandle = null,
|
dragHandle = null,
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||||
) {
|
) {
|
||||||
MenuHeader(target)
|
MenuHeader(target)
|
||||||
when (target) {
|
when (target) {
|
||||||
|
|||||||
@@ -528,6 +528,7 @@ fun LibraryScreen(
|
|||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
onDismissRequest = { showOptions = false },
|
onDismissRequest = { showOptions = false },
|
||||||
dragHandle = null,
|
dragHandle = null,
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||||
) {
|
) {
|
||||||
ListOptionsSheet(
|
ListOptionsSheet(
|
||||||
listQuery = listQuery,
|
listQuery = listQuery,
|
||||||
|
|||||||
Reference in New Issue
Block a user