diff options
| author | 2023-03-11 00:35:01 -0500 | |
|---|---|---|
| committer | 2023-06-03 00:05:40 -0700 | |
| commit | fcce7b898f5f8b9821157097ac38612bd60d0792 (patch) | |
| tree | 115aa6eaa0dc2852463fad42b08ab98ababecd16 /src/android | |
| parent | android: Convert PlatformGamesFragment to Kotlin (diff) | |
| download | yuzu-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.java | 42 | ||||
| -rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/platform/PlatformGamesPresenter.kt | 30 |
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 @@ | |||
| 1 | package org.yuzu.yuzu_emu.ui.platform; | ||
| 2 | |||
| 3 | |||
| 4 | import org.yuzu.yuzu_emu.YuzuApplication; | ||
| 5 | import org.yuzu.yuzu_emu.model.GameDatabase; | ||
| 6 | import org.yuzu.yuzu_emu.utils.Log; | ||
| 7 | |||
| 8 | import rx.android.schedulers.AndroidSchedulers; | ||
| 9 | import rx.schedulers.Schedulers; | ||
| 10 | |||
| 11 | public 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 @@ | |||
| 1 | package org.yuzu.yuzu_emu.ui.platform | ||
| 2 | |||
| 3 | import android.database.Cursor | ||
| 4 | import org.yuzu.yuzu_emu.YuzuApplication | ||
| 5 | import org.yuzu.yuzu_emu.utils.Log | ||
| 6 | import rx.android.schedulers.AndroidSchedulers | ||
| 7 | import rx.schedulers.Schedulers | ||
| 8 | |||
| 9 | class 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 | } | ||