ui: fix incorrect back navigation

Fix the app incorrectly navigating away when a gesture accidentally
dragged one of the bottom sheets.
This commit is contained in:
Alexander Capehart 2023-05-29 11:50:44 -06:00
parent 40af4adc51
commit 841ea3620a
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -512,14 +512,15 @@ class MainFragment :
binding.queueSheet.coordinatorLayoutBehavior as QueueBottomSheetBehavior? binding.queueSheet.coordinatorLayoutBehavior as QueueBottomSheetBehavior?
val exploreNavController = binding.exploreNavHost.findNavController() val exploreNavController = binding.exploreNavHost.findNavController()
// TODO: Debug why this fails sometimes on the playback sheet
// TODO: Add playlist editing to enabled check
// TODO: Chain these listeners in some way instead of keeping them all here, // TODO: Chain these listeners in some way instead of keeping them all here,
// assuming listeners added later have more priority // assuming listeners added later have more priority
isEnabled = isEnabled =
queueSheetBehavior?.state == BackportBottomSheetBehavior.STATE_EXPANDED || (queueSheetBehavior != null &&
playbackSheetBehavior.state == BackportBottomSheetBehavior.STATE_EXPANDED || queueSheetBehavior.state != BackportBottomSheetBehavior.STATE_COLLAPSED &&
playbackSheetBehavior.state == BackportBottomSheetBehavior.STATE_EXPANDED) ||
(playbackSheetBehavior.state != BackportBottomSheetBehavior.STATE_COLLAPSED &&
playbackSheetBehavior.state != BackportBottomSheetBehavior.STATE_HIDDEN) ||
detailModel.editedPlaylist.value != null || detailModel.editedPlaylist.value != null ||
selectionModel.selected.value.isNotEmpty() || selectionModel.selected.value.isNotEmpty() ||
exploreNavController.currentDestination?.id != exploreNavController.currentDestination?.id !=