diff options
| author | 2023-03-11 00:36:43 -0500 | |
|---|---|---|
| committer | 2023-06-03 00:05:40 -0700 | |
| commit | c9d2d74f1f56f15f56d5413c3d9925bf46b73ba0 (patch) | |
| tree | f66ee6b2bd69d0f7f1c997a86211263c1c7f82f6 /src/android | |
| parent | android: Convert DocumentsTree to Kotlin (diff) | |
| download | yuzu-c9d2d74f1f56f15f56d5413c3d9925bf46b73ba0.tar.gz yuzu-c9d2d74f1f56f15f56d5413c3d9925bf46b73ba0.tar.xz yuzu-c9d2d74f1f56f15f56d5413c3d9925bf46b73ba0.zip | |
android: Convert EmulationMenuSettings to Kotlin
Diffstat (limited to 'src/android')
| -rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java | 78 | ||||
| -rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt | 59 |
2 files changed, 59 insertions, 78 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java deleted file mode 100644 index 0b11b9cc0..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | package org.yuzu.yuzu_emu.utils; | ||
| 2 | |||
| 3 | import android.content.SharedPreferences; | ||
| 4 | import android.preference.PreferenceManager; | ||
| 5 | |||
| 6 | import org.yuzu.yuzu_emu.YuzuApplication; | ||
| 7 | |||
| 8 | public class EmulationMenuSettings { | ||
| 9 | private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext()); | ||
| 10 | |||
| 11 | // These must match what is defined in src/core/settings.h | ||
| 12 | public static final int LayoutOption_Default = 0; | ||
| 13 | public static final int LayoutOption_SingleScreen = 1; | ||
| 14 | public static final int LayoutOption_LargeScreen = 2; | ||
| 15 | public static final int LayoutOption_SideScreen = 3; | ||
| 16 | public static final int LayoutOption_MobilePortrait = 4; | ||
| 17 | public static final int LayoutOption_MobileLandscape = 5; | ||
| 18 | |||
| 19 | public static boolean getJoystickRelCenter() { | ||
| 20 | return mPreferences.getBoolean("EmulationMenuSettings_JoystickRelCenter", true); | ||
| 21 | } | ||
| 22 | |||
| 23 | public static void setJoystickRelCenter(boolean value) { | ||
| 24 | final SharedPreferences.Editor editor = mPreferences.edit(); | ||
| 25 | editor.putBoolean("EmulationMenuSettings_JoystickRelCenter", value); | ||
| 26 | editor.apply(); | ||
| 27 | } | ||
| 28 | |||
| 29 | public static boolean getDpadSlideEnable() { | ||
| 30 | return mPreferences.getBoolean("EmulationMenuSettings_DpadSlideEnable", true); | ||
| 31 | } | ||
| 32 | |||
| 33 | public static void setDpadSlideEnable(boolean value) { | ||
| 34 | final SharedPreferences.Editor editor = mPreferences.edit(); | ||
| 35 | editor.putBoolean("EmulationMenuSettings_DpadSlideEnable", value); | ||
| 36 | editor.apply(); | ||
| 37 | } | ||
| 38 | |||
| 39 | public static int getLandscapeScreenLayout() { | ||
| 40 | return mPreferences.getInt("EmulationMenuSettings_LandscapeScreenLayout", LayoutOption_MobileLandscape); | ||
| 41 | } | ||
| 42 | |||
| 43 | public static void setLandscapeScreenLayout(int value) { | ||
| 44 | final SharedPreferences.Editor editor = mPreferences.edit(); | ||
| 45 | editor.putInt("EmulationMenuSettings_LandscapeScreenLayout", value); | ||
| 46 | editor.apply(); | ||
| 47 | } | ||
| 48 | |||
| 49 | public static boolean getShowFps() { | ||
| 50 | return mPreferences.getBoolean("EmulationMenuSettings_ShowFps", false); | ||
| 51 | } | ||
| 52 | |||
| 53 | public static void setShowFps(boolean value) { | ||
| 54 | final SharedPreferences.Editor editor = mPreferences.edit(); | ||
| 55 | editor.putBoolean("EmulationMenuSettings_ShowFps", value); | ||
| 56 | editor.apply(); | ||
| 57 | } | ||
| 58 | |||
| 59 | public static boolean getSwapScreens() { | ||
| 60 | return mPreferences.getBoolean("EmulationMenuSettings_SwapScreens", false); | ||
| 61 | } | ||
| 62 | |||
| 63 | public static void setSwapScreens(boolean value) { | ||
| 64 | final SharedPreferences.Editor editor = mPreferences.edit(); | ||
| 65 | editor.putBoolean("EmulationMenuSettings_SwapScreens", value); | ||
| 66 | editor.apply(); | ||
| 67 | } | ||
| 68 | |||
| 69 | public static boolean getShowOverlay() { | ||
| 70 | return mPreferences.getBoolean("EmulationMenuSettings_ShowOverylay", true); | ||
| 71 | } | ||
| 72 | |||
| 73 | public static void setShowOverlay(boolean value) { | ||
| 74 | final SharedPreferences.Editor editor = mPreferences.edit(); | ||
| 75 | editor.putBoolean("EmulationMenuSettings_ShowOverylay", value); | ||
| 76 | editor.apply(); | ||
| 77 | } | ||
| 78 | } | ||
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt new file mode 100644 index 000000000..ae654f596 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | package org.yuzu.yuzu_emu.utils | ||
| 2 | |||
| 3 | import androidx.preference.PreferenceManager | ||
| 4 | import org.yuzu.yuzu_emu.YuzuApplication | ||
| 5 | import org.yuzu.yuzu_emu.features.settings.model.Settings | ||
| 6 | |||
| 7 | object EmulationMenuSettings { | ||
| 8 | private val preferences = | ||
| 9 | PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) | ||
| 10 | |||
| 11 | // These must match what is defined in src/core/settings.h | ||
| 12 | const val LayoutOption_Default = 0 | ||
| 13 | const val LayoutOption_SingleScreen = 1 | ||
| 14 | const val LayoutOption_LargeScreen = 2 | ||
| 15 | const val LayoutOption_SideScreen = 3 | ||
| 16 | const val LayoutOption_MobilePortrait = 4 | ||
| 17 | const val LayoutOption_MobileLandscape = 5 | ||
| 18 | |||
| 19 | var joystickRelCenter: Boolean | ||
| 20 | get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, true) | ||
| 21 | set(value) { | ||
| 22 | preferences.edit() | ||
| 23 | .putBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, value) | ||
| 24 | .apply() | ||
| 25 | } | ||
| 26 | var dpadSlideEnable: Boolean | ||
| 27 | get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, true) | ||
| 28 | set(value) { | ||
| 29 | preferences.edit() | ||
| 30 | .putBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, value) | ||
| 31 | .apply() | ||
| 32 | } | ||
| 33 | |||
| 34 | @JvmStatic | ||
| 35 | var landscapeScreenLayout: Int | ||
| 36 | get() = preferences.getInt( | ||
| 37 | Settings.PREF_MENU_SETTINGS_LANDSCAPE, | ||
| 38 | LayoutOption_MobileLandscape | ||
| 39 | ) | ||
| 40 | set(value) { | ||
| 41 | preferences.edit() | ||
| 42 | .putInt(Settings.PREF_MENU_SETTINGS_LANDSCAPE, value) | ||
| 43 | .apply() | ||
| 44 | } | ||
| 45 | var showFps: Boolean | ||
| 46 | get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, false) | ||
| 47 | set(value) { | ||
| 48 | preferences.edit() | ||
| 49 | .putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, value) | ||
| 50 | .apply() | ||
| 51 | } | ||
| 52 | var showOverlay: Boolean | ||
| 53 | get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_OVERLAY, true) | ||
| 54 | set(value) { | ||
| 55 | preferences.edit() | ||
| 56 | .putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_OVERLAY, value) | ||
| 57 | .apply() | ||
| 58 | } | ||
| 59 | } | ||