only updating the visibility of the menu option the home details fragment adds instead of changing all the parent options

- fixes the debug sync options being forced to visible
This commit is contained in:
Adam Brown 2021-10-13 13:39:57 +01:00
parent 4f51dbdcf9
commit 64dce0638f

View File

@ -108,9 +108,9 @@ class HomeDetailFragment @Inject constructor(
override fun onPrepareOptionsMenu(menu: Menu) { override fun onPrepareOptionsMenu(menu: Menu) {
withState(viewModel) { state -> withState(viewModel) { state ->
menu.iterator().forEach { it.isVisible = state.currentTab is HomeTab.RoomList } val isRoomList = state.currentTab is HomeTab.RoomList
menu.findItem(R.id.menu_home_mark_all_as_read).isVisible = isRoomList && hasUnreadRooms
} }
menu.findItem(R.id.menu_home_mark_all_as_read).isVisible = hasUnreadRooms
super.onPrepareOptionsMenu(menu) super.onPrepareOptionsMenu(menu)
} }