Skip to content

Commit

Permalink
[Refactor/#107] observe viewLifecycleOwner 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ss99x2002 committed Aug 24, 2023
1 parent 833ff95 commit 57cace4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
}

private fun observeData() {
viewModel.homeData.observe(requireActivity()) {
viewModel.homeData.observe(viewLifecycleOwner) {
setBackground(it.section)
}
viewModel.responseCaseData.observe(requireActivity()) {
viewModel.responseCaseData.observe(viewLifecycleOwner) {
setClickEvent(it)
}
}
Expand Down Expand Up @@ -75,7 +75,9 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
}
)
Handler(Looper.getMainLooper()).postDelayed({
(activity as MainActivity).getLoadingView().visibility = View.INVISIBLE
if (activity != null) {
(activity as MainActivity).getLoadingView().visibility = View.INVISIBLE
}
}, 1000)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ListFragment : BindingFragment<FragmentListBinding>(R.layout.fragment_list
}

private fun observeData() {
viewModel.listResponseDto.observe(requireActivity()) {
viewModel.listResponseDto.observe(viewLifecycleOwner) {
listQuestionAdapter.submitList(it)
}
}
Expand Down

0 comments on commit 57cace4

Please sign in to comment.