summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-03-11 06:35:01 +0100
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:40 +0200
commitfcce7b898f5f8b9821157097ac38612bd60d0792 (patch)
tree115aa6eaa0dc2852463fad42b08ab98ababecd16 /src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt
parentandroid: Convert PlatformGamesFragment to Kotlin (diff)
downloadyuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar.gz
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar.bz2
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar.lz
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar.xz
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar.zst
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.zip
Diffstat (limited to '')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt
new file mode 100644
index 000000000..f888d579f
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt
@@ -0,0 +1,30 @@
+package org.yuzu.yuzu_emu.ui.platform
+
+import android.database.Cursor
+import org.yuzu.yuzu_emu.YuzuApplication
+import org.yuzu.yuzu_emu.utils.Log
+import rx.android.schedulers.AndroidSchedulers
+import rx.schedulers.Schedulers
+
+class PlatformGamesPresenter(private val view: PlatformGamesView) {
+ fun onCreateView() {
+ loadGames()
+ }
+
+ fun refresh() {
+ Log.debug("[PlatformGamesPresenter] : Refreshing...")
+ loadGames()
+ }
+
+ private fun loadGames() {
+ Log.debug("[PlatformGamesPresenter] : Loading games...")
+ val databaseHelper = YuzuApplication.databaseHelper
+ databaseHelper!!.games
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe { games: Cursor? ->
+ Log.debug("[PlatformGamesPresenter] : Load finished, swapping cursor...")
+ view.showGames(games!!)
+ }
+ }
+}