Skip to content
Snippets Groups Projects
Unverified Commit 0c55248f authored by Charles Lombardo's avatar Charles Lombardo Committed by GitHub
Browse files

Merge pull request #11503 from t895/stateflow-patch

android: Delay collecting UI state in games fragment
parents 5eceab3c b3943891
No related branches found
No related tags found
No related merge requests found
......@@ -93,12 +93,12 @@ class GamesFragment : Fragment() {
viewLifecycleOwner.lifecycleScope.apply {
launch {
repeatOnLifecycle(Lifecycle.State.CREATED) {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
gamesViewModel.isReloading.collect { binding.swipeRefresh.isRefreshing = it }
}
}
launch {
repeatOnLifecycle(Lifecycle.State.CREATED) {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
gamesViewModel.games.collect {
(binding.gridGames.adapter as GameAdapter).submitList(it)
if (it.isEmpty()) {
......@@ -110,7 +110,7 @@ class GamesFragment : Fragment() {
}
}
launch {
repeatOnLifecycle(Lifecycle.State.CREATED) {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
gamesViewModel.shouldSwapData.collect {
if (it) {
(binding.gridGames.adapter as GameAdapter).submitList(
......@@ -122,7 +122,7 @@ class GamesFragment : Fragment() {
}
}
launch {
repeatOnLifecycle(Lifecycle.State.CREATED) {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
gamesViewModel.shouldScrollToTop.collect {
if (it) {
scrollToTop()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment