Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed Aug 7, 2023
1 parent 6589da7 commit 9f71f23
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,14 @@ class TimelineFragment : Fragment(R.layout.fragment_swipe_refresh_recycler_view)
mViewModel.loadNew()
}

mViewModel.isLoading.observe(viewLifecycleOwner, Observer {
if (it != null && !it) {
mViewModel.isLoading.onEach {
if (!it) {
mBinding.refresh.isRefreshing = false
}
})
}.flowWithLifecycle(
viewLifecycleOwner.lifecycle,
Lifecycle.State.RESUMED
).launchIn(viewLifecycleOwner.lifecycleScope)


mBinding.listView.adapter = adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ class NotificationFragment : Fragment(R.layout.fragment_notification) {
).launchIn(viewLifecycleOwner.lifecycleScope)


mViewModel.isLoading.observe(viewLifecycleOwner) {
mViewModel.isLoading.onEach {
mBinding.notificationSwipeRefresh.isRefreshing = it
}
}.flowWithLifecycle(
viewLifecycleOwner.lifecycle,
Lifecycle.State.RESUMED
).launchIn(viewLifecycleOwner.lifecycleScope)

mBinding.notificationSwipeRefresh.setOnRefreshListener {
mViewModel.loadInit()
Expand Down

0 comments on commit 9f71f23

Please sign in to comment.