From 77578dfaf961a8533342c86b99944da73c1d57f1 Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 2 Jan 2024 13:40:00 +0100 Subject: [PATCH] fix: [ANDROAPP-5716] responsive filters on events list --- .../programEventDetail/eventList/EventListFragment.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/dhis2/usescases/programEventDetail/eventList/EventListFragment.kt b/app/src/main/java/org/dhis2/usescases/programEventDetail/eventList/EventListFragment.kt index ee7e1d459ff..d2151d16de6 100644 --- a/app/src/main/java/org/dhis2/usescases/programEventDetail/eventList/EventListFragment.kt +++ b/app/src/main/java/org/dhis2/usescases/programEventDetail/eventList/EventListFragment.kt @@ -36,6 +36,7 @@ class EventListFragment : FragmentGlobalAbstract(), EventListFragmentView { lateinit var binding: FragmentProgramEventDetailListBinding private var liveAdapter: ProgramEventDetailLiveAdapter? = null private val programEventsViewModel: ProgramEventDetailViewModel by activityViewModels() + private var liveDataList: LiveData>? = null @Inject lateinit var presenter: EventListPresenter @@ -97,9 +98,9 @@ class EventListFragment : FragmentGlobalAbstract(), EventListFragmentView { } override fun setLiveData(pagedListLiveData: LiveData>) { - pagedListLiveData.observe( - this, - ) { pagedList: PagedList -> + liveDataList?.removeObservers(viewLifecycleOwner) + this.liveDataList = pagedListLiveData + liveDataList?.observe(viewLifecycleOwner) { pagedList: PagedList -> programEventsViewModel.setProgress(false) liveAdapter?.submitList(pagedList) { if ((binding.recycler.adapter?.itemCount ?: 0) == 0) {