Skip to content

Commit

Permalink
#187 setOnMoreClickListner 데이터바인딩으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Jul 25, 2023
1 parent f79155f commit 2a84447
Showing 1 changed file with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,23 @@ class RecentPenaltyListFragment :

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initHeader()
setBinding()
}

private fun setBinding() = binding.apply {
fragmentViewModel.apply {
viewLifecycleOwner.apply {
repeatOnStarted {
recallDisposalList.stateAsCollect(headerView, noHistoryTextView).collect { uiState ->
handleUiState(uiState)
}
}
repeatOnStarted { eventFlow.collect { event -> handleEvent(event) } }
}
noHistoryTextView.text = medicineInfoMapper.getNoHistorySpan(requireContext())
}
setRecyclerView()
}

private fun setRecyclerView() {
penaltyListAdapter = PenaltyListAdapter()
Expand Down Expand Up @@ -64,27 +77,6 @@ class RecentPenaltyListFragment :
}
}

private fun setBinding() {
binding.apply {
fragmentViewModel.apply {
viewLifecycleOwner.apply {
repeatOnStarted {
recallDisposalList.stateAsCollect(headerView, noHistoryTextView).collect { uiState ->
handleUiState(uiState)
}
}
repeatOnStarted {
eventFlow.collect { event ->
handleEvent(event)
}
}
}
noHistoryTextView.text = medicineInfoMapper.getNoHistorySpan(requireContext())
}
}
setRecyclerView()
}

private fun handleEvent(event: RecentPenaltyListViewModel.PenaltyListEvent) {
when (event) {
is RecentPenaltyListViewModel.PenaltyListEvent.NavigateToNews -> navigateToNews()
Expand Down

0 comments on commit 2a84447

Please sign in to comment.