Browse Source

android: Collect latest information for games list

nce_cpp
t895 2 years ago
parent
commit
1c0730959b
  1. 3
      src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SearchFragment.kt
  2. 2
      src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt

3
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 {

2
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

Loading…
Cancel
Save