Skip to content

Commit

Permalink
feat: 현재 선택된 칩의 필터링에 해당하는 리스트를 요청한다
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongHoonC committed Nov 13, 2023
1 parent b5413d5 commit 7167c90
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class FestivalListFragment : Fragment(R.layout.fragment_festival_list) {
initFestivalListSpanSize()
initRefresh()
initFestivalFilters()
vm.loadFestivals(vm.festivalFilter.value)
loadFestivalsBy(binding.cgFilterOption.checkedChipId)
}

private fun initFestivalListSpanSize() {
Expand All @@ -81,18 +81,22 @@ class FestivalListFragment : Fragment(R.layout.fragment_festival_list) {

private fun initRefresh() {
binding.srlFestivalList.setOnRefreshListener {
vm.loadFestivals(vm.festivalFilter.value)
loadFestivalsBy(binding.cgFilterOption.checkedChipId)
binding.srlFestivalList.isRefreshing = false
}
}

private fun initFestivalFilters() {
binding.cgFilterOption.setOnCheckedStateChangeListener { group, _ ->
when (group.checkedChipId) {
R.id.chipProgress -> vm.loadFestivals(FestivalFilter.PROGRESS)
R.id.chipPlanned -> vm.loadFestivals(FestivalFilter.PLANNED)
R.id.chipEnd -> vm.loadFestivals(FestivalFilter.END)
}
loadFestivalsBy(checkedChipId = group.checkedChipId)
}
}

private fun loadFestivalsBy(checkedChipId: Int) {
when (checkedChipId) {
R.id.chipProgress -> vm.loadFestivals(FestivalFilter.PROGRESS)
R.id.chipPlanned -> vm.loadFestivals(FestivalFilter.PLANNED)
R.id.chipEnd -> vm.loadFestivals(FestivalFilter.END)
}
}

Expand Down

0 comments on commit 7167c90

Please sign in to comment.