From a826a50c1031d65e9ccfc69561afce3f91ea0a5f Mon Sep 17 00:00:00 2001 From: Maxime Naturel Date: Thu, 17 Feb 2022 17:21:46 +0100 Subject: [PATCH] Renaming observe item count method --- .../app/features/home/room/list/RoomListFragment.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt index bcc062f3a8..0300a72e9c 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt @@ -52,7 +52,6 @@ import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedA import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel import im.vector.app.features.home.room.list.widget.NotifsFabMenuView import im.vector.app.features.notifications.NotificationDrawerManager -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch @@ -291,7 +290,7 @@ class RoomListFragment @Inject constructor( )) checkEmptyState() } - listenItemCount(section, sectionAdapter) + observeItemCount(section, sectionAdapter) section.notificationCount.observe(viewLifecycleOwner) { counts -> sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy( notificationCount = counts.totalCount, @@ -315,7 +314,7 @@ class RoomListFragment @Inject constructor( )) checkEmptyState() } - listenItemCount(section, sectionAdapter) + observeItemCount(section, sectionAdapter) section.isExpanded.observe(viewLifecycleOwner) { _ -> refreshCollapseStates() } @@ -332,7 +331,7 @@ class RoomListFragment @Inject constructor( isLoading = false)) checkEmptyState() } - listenItemCount(section, sectionAdapter) + observeItemCount(section, sectionAdapter) section.notificationCount.observe(viewLifecycleOwner) { counts -> sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy( notificationCount = counts.totalCount, @@ -380,7 +379,7 @@ class RoomListFragment @Inject constructor( } } - private fun listenItemCount(section: RoomsSection, sectionAdapter: SectionHeaderAdapter) { + private fun observeItemCount(section: RoomsSection, sectionAdapter: SectionHeaderAdapter) { lifecycleScope.launch { section.itemCount .flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)