Skip to content

Commit

Permalink
fix: [ANDROAPP-5716] responsive filters on events list (#3454)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmateos authored Jan 11, 2024
1 parent 05d9897 commit fad8dc2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<PagedList<EventViewModel>>? = null

@Inject
lateinit var presenter: EventListPresenter
Expand Down Expand Up @@ -97,9 +98,9 @@ class EventListFragment : FragmentGlobalAbstract(), EventListFragmentView {
}

override fun setLiveData(pagedListLiveData: LiveData<PagedList<EventViewModel>>) {
pagedListLiveData.observe(
this,
) { pagedList: PagedList<EventViewModel> ->
liveDataList?.removeObservers(viewLifecycleOwner)
this.liveDataList = pagedListLiveData
liveDataList?.observe(viewLifecycleOwner) { pagedList: PagedList<EventViewModel> ->
programEventsViewModel.setProgress(false)
liveAdapter?.submitList(pagedList) {
if ((binding.recycler.adapter?.itemCount ?: 0) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ fun WorkingListChipGroup(
FilterManager.getInstance().currentWorkingList(),
)
}
FilterManager.getInstance().observeWorkingListScope().addOnPropertyChangedCallback(
object : Observable.OnPropertyChangedCallback() {
override fun onPropertyChanged(sender: Observable?, propertyId: Int) {
selectedWorkingList = FilterManager.getInstance().currentWorkingList()
}
},
)

workingListFilterState.value?.let { workingListFilter ->
LazyRow(modifier) {
Expand All @@ -98,10 +105,9 @@ fun WorkingListChipGroup(
},
),
label = workingList.label,
selected = selectedWorkingList == workingList,
selected = selectedWorkingList?.uid == workingList.uid,
onSelected = { _ ->
workingListFilter.onChecked(workingList.id())
selectedWorkingList = FilterManager.getInstance().currentWorkingList()
},
)
}
Expand Down

0 comments on commit fad8dc2

Please sign in to comment.