From 64dce0638f7007cc508177fa62177753b6dacfaa Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 13 Oct 2021 13:39:57 +0100 Subject: [PATCH] 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 --- .../java/im/vector/app/features/home/HomeDetailFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt index c8fff5605b..df95bb9b14 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt @@ -108,9 +108,9 @@ class HomeDetailFragment @Inject constructor( override fun onPrepareOptionsMenu(menu: Menu) { 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) }