summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
authorGravatar Charles Lombardo2023-03-11 00:35:01 -0500
committerGravatar bunnei2023-06-03 00:05:40 -0700
commitfcce7b898f5f8b9821157097ac38612bd60d0792 (patch)
tree115aa6eaa0dc2852463fad42b08ab98ababecd16 /src/android
parentandroid: Convert PlatformGamesFragment to Kotlin (diff)
downloadyuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar.gz
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.tar.xz
yuzu-fcce7b898f5f8b9821157097ac38612bd60d0792.zip
android: Convert PlatformGamesPresenter to Kotlin
Diffstat (limited to 'src/android')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.java42
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt30
2 files changed, 30 insertions, 42 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.java
deleted file mode 100644
index effd4a7d1..000000000
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.java
+++ /dev/null
@@ -1,42 +0,0 @@
1package org.yuzu.yuzu_emu.ui.platform;
2
3
4import org.yuzu.yuzu_emu.YuzuApplication;
5import org.yuzu.yuzu_emu.model.GameDatabase;
6import org.yuzu.yuzu_emu.utils.Log;
7
8import rx.android.schedulers.AndroidSchedulers;
9import rx.schedulers.Schedulers;
10
11public final class PlatformGamesPresenter {
12 private final PlatformGamesView mView;
13
14 public PlatformGamesPresenter(PlatformGamesView view) {
15 mView = view;
16 }
17
18 public void onCreateView() {
19 loadGames();
20 }
21
22 public void refresh() {
23 Log.debug("[PlatformGamesPresenter] : Refreshing...");
24 loadGames();
25 }
26
27 private void loadGames() {
28 Log.debug("[PlatformGamesPresenter] : Loading games...");
29
30 GameDatabase databaseHelper = YuzuApplication.databaseHelper;
31
32 databaseHelper.getGames()
33 .subscribeOn(Schedulers.io())
34 .observeOn(AndroidSchedulers.mainThread())
35 .subscribe(games ->
36 {
37 Log.debug("[PlatformGamesPresenter] : Load finished, swapping cursor...");
38
39 mView.showGames(games);
40 });
41 }
42}
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 @@
1package org.yuzu.yuzu_emu.ui.platform
2
3import android.database.Cursor
4import org.yuzu.yuzu_emu.YuzuApplication
5import org.yuzu.yuzu_emu.utils.Log
6import rx.android.schedulers.AndroidSchedulers
7import rx.schedulers.Schedulers
8
9class PlatformGamesPresenter(private val view: PlatformGamesView) {
10 fun onCreateView() {
11 loadGames()
12 }
13
14 fun refresh() {
15 Log.debug("[PlatformGamesPresenter] : Refreshing...")
16 loadGames()
17 }
18
19 private fun loadGames() {
20 Log.debug("[PlatformGamesPresenter] : Loading games...")
21 val databaseHelper = YuzuApplication.databaseHelper
22 databaseHelper!!.games
23 .subscribeOn(Schedulers.io())
24 .observeOn(AndroidSchedulers.mainThread())
25 .subscribe { games: Cursor? ->
26 Log.debug("[PlatformGamesPresenter] : Load finished, swapping cursor...")
27 view.showGames(games!!)
28 }
29 }
30}