From 7ea7c72dde7dd0aa1ed7adf5a622303da2420782 Mon Sep 17 00:00:00 2001 From: t895 Date: Sun, 10 Dec 2023 20:52:28 -0500 Subject: android: Collect latest information for games list --- .../app/src/main/java/org/yuzu/yuzu_emu/fragments/SearchFragment.kt | 3 ++- src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/android/app') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SearchFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SearchFragment.kt index 3ac054d8f..64b295fbd 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SearchFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SearchFragment.kt @@ -24,6 +24,7 @@ import androidx.lifecycle.repeatOnLifecycle import androidx.preference.PreferenceManager import info.debatty.java.stringsimilarity.Jaccard import info.debatty.java.stringsimilarity.JaroWinkler +import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch import java.util.Locale import org.yuzu.yuzu_emu.R @@ -101,7 +102,7 @@ class SearchFragment : Fragment() { } launch { repeatOnLifecycle(Lifecycle.State.CREATED) { - gamesViewModel.games.collect { filterAndSearch() } + gamesViewModel.games.collectLatest { filterAndSearch() } } } launch { diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt index d5acf8479..fc0eeb9ad 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt @@ -96,7 +96,7 @@ class GamesFragment : Fragment() { } launch { repeatOnLifecycle(Lifecycle.State.RESUMED) { - gamesViewModel.games.collect { + gamesViewModel.games.collectLatest { (binding.gridGames.adapter as GameAdapter).submitList(it) if (it.isEmpty()) { binding.noticeText.visibility = View.VISIBLE -- cgit v1.2.3