From 841ea3620a87185155e68dd7639c94300720c423 Mon Sep 17 00:00:00 2001 From: Alexander Capehart Date: Mon, 29 May 2023 11:50:44 -0600 Subject: [PATCH] ui: fix incorrect back navigation Fix the app incorrectly navigating away when a gesture accidentally dragged one of the bottom sheets. --- app/src/main/java/org/oxycblt/auxio/MainFragment.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/MainFragment.kt b/app/src/main/java/org/oxycblt/auxio/MainFragment.kt index a9dd01b37..78e8a7e51 100644 --- a/app/src/main/java/org/oxycblt/auxio/MainFragment.kt +++ b/app/src/main/java/org/oxycblt/auxio/MainFragment.kt @@ -512,14 +512,15 @@ class MainFragment : binding.queueSheet.coordinatorLayoutBehavior as QueueBottomSheetBehavior? 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, // assuming listeners added later have more priority isEnabled = - queueSheetBehavior?.state == BackportBottomSheetBehavior.STATE_EXPANDED || - playbackSheetBehavior.state == BackportBottomSheetBehavior.STATE_EXPANDED || + (queueSheetBehavior != null && + queueSheetBehavior.state != BackportBottomSheetBehavior.STATE_COLLAPSED && + playbackSheetBehavior.state == BackportBottomSheetBehavior.STATE_EXPANDED) || + (playbackSheetBehavior.state != BackportBottomSheetBehavior.STATE_COLLAPSED && + playbackSheetBehavior.state != BackportBottomSheetBehavior.STATE_HIDDEN) || detailModel.editedPlaylist.value != null || selectionModel.selected.value.isNotEmpty() || exploreNavController.currentDestination?.id !=