diff --git a/app/src/main/java/org/oxycblt/auxio/home/HomeFragment.kt b/app/src/main/java/org/oxycblt/auxio/home/HomeFragment.kt index 83610fd46..ff2ff742b 100644 --- a/app/src/main/java/org/oxycblt/auxio/home/HomeFragment.kt +++ b/app/src/main/java/org/oxycblt/auxio/home/HomeFragment.kt @@ -208,12 +208,14 @@ class HomeFragment : updateFabVisibility( homeModel.songList.value, homeModel.isFastScrolling.value, + homeModel.sheetObscuresFab.value, homeModel.currentTabType.value) // --- VIEWMODEL SETUP --- collect(homeModel.recreateTabs.flow, ::handleRecreate) collectImmediately(homeModel.currentTabType, ::updateCurrentTab) - collectImmediately(homeModel.songList, homeModel.isFastScrolling, ::updateFab) + collectImmediately( + homeModel.songList, homeModel.isFastScrolling, homeModel.sheetObscuresFab, ::updateFab) collect(homeModel.speedDialOpen, ::updateSpeedDial) collect(detailModel.toShow.flow, ::handleShow) collect(listModel.menu.flow, ::handleMenu) @@ -373,7 +375,11 @@ class HomeFragment : MusicType.PLAYLISTS -> R.id.home_playlist_recycler } - updateFabVisibility(homeModel.songList.value, homeModel.isFastScrolling.value, tabType) + updateFabVisibility( + homeModel.songList.value, + homeModel.isFastScrolling.value, + homeModel.sheetObscuresFab.value, + tabType) } private fun handleRecreate(recreate: Unit?) { @@ -408,6 +414,7 @@ class HomeFragment : updateFabVisibility( homeModel.songList.value, homeModel.isFastScrolling.value, + homeModel.sheetObscuresFab.value, homeModel.currentTabType.value) binding.homeIndexingContainer.visibility = View.INVISIBLE return @@ -553,20 +560,21 @@ class HomeFragment : } } - private fun updateFab(songs: List, isFastScrolling: Boolean) { - updateFabVisibility(songs, isFastScrolling, homeModel.currentTabType.value) + private fun updateFab(songs: List, isFastScrolling: Boolean, sheetRising: Boolean) { + updateFabVisibility(songs, isFastScrolling, sheetRising, homeModel.currentTabType.value) } private fun updateFabVisibility( songs: List, isFastScrolling: Boolean, + sheetRising: Boolean, tabType: MusicType ) { val binding = requireBinding() // If there are no songs, it's likely that the library has not been loaded, so // displaying the shuffle FAB makes no sense. We also don't want the fast scroll // popup to overlap with the FAB, so we hide the FAB when fast scrolling too. - if (songs.isEmpty() || isFastScrolling) { + if (songs.isEmpty() || isFastScrolling || sheetRising) { logD("Hiding fab: [empty: ${songs.isEmpty()} scrolling: $isFastScrolling]") hideAllFabs() } else { diff --git a/app/src/main/java/org/oxycblt/auxio/home/HomeViewModel.kt b/app/src/main/java/org/oxycblt/auxio/home/HomeViewModel.kt index 51bc04976..08c85333e 100644 --- a/app/src/main/java/org/oxycblt/auxio/home/HomeViewModel.kt +++ b/app/src/main/java/org/oxycblt/auxio/home/HomeViewModel.kt @@ -160,6 +160,9 @@ constructor( /** A marker for whether the speed dial is open or not. */ val speedDialOpen: StateFlow = _speedDialOpen + private val _sheetObscuresFab = MutableStateFlow(false) + val sheetObscuresFab: StateFlow = _sheetObscuresFab + private val _showOuter = MutableEvent() val showOuter: Event get() = _showOuter @@ -307,6 +310,11 @@ constructor( _speedDialOpen.value = speedDialOpen } + fun setSheetRising(sheetRising: Boolean) { + logD("Updating sheet rising state: $sheetRising") + _sheetObscuresFab.value = sheetRising + } + fun showSettings() { _showOuter.put(Outer.Settings) }