mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-22 16:30:57 +01:00
android: Convert EmulationMenuSettings to Kotlin
This commit is contained in:
parent
2444df2bf4
commit
c9d2d74f1f
2 changed files with 59 additions and 78 deletions
|
@ -1,78 +0,0 @@
|
|||
package org.yuzu.yuzu_emu.utils;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||
|
||||
public class EmulationMenuSettings {
|
||||
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||
|
||||
// These must match what is defined in src/core/settings.h
|
||||
public static final int LayoutOption_Default = 0;
|
||||
public static final int LayoutOption_SingleScreen = 1;
|
||||
public static final int LayoutOption_LargeScreen = 2;
|
||||
public static final int LayoutOption_SideScreen = 3;
|
||||
public static final int LayoutOption_MobilePortrait = 4;
|
||||
public static final int LayoutOption_MobileLandscape = 5;
|
||||
|
||||
public static boolean getJoystickRelCenter() {
|
||||
return mPreferences.getBoolean("EmulationMenuSettings_JoystickRelCenter", true);
|
||||
}
|
||||
|
||||
public static void setJoystickRelCenter(boolean value) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean("EmulationMenuSettings_JoystickRelCenter", value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean getDpadSlideEnable() {
|
||||
return mPreferences.getBoolean("EmulationMenuSettings_DpadSlideEnable", true);
|
||||
}
|
||||
|
||||
public static void setDpadSlideEnable(boolean value) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean("EmulationMenuSettings_DpadSlideEnable", value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static int getLandscapeScreenLayout() {
|
||||
return mPreferences.getInt("EmulationMenuSettings_LandscapeScreenLayout", LayoutOption_MobileLandscape);
|
||||
}
|
||||
|
||||
public static void setLandscapeScreenLayout(int value) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putInt("EmulationMenuSettings_LandscapeScreenLayout", value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean getShowFps() {
|
||||
return mPreferences.getBoolean("EmulationMenuSettings_ShowFps", false);
|
||||
}
|
||||
|
||||
public static void setShowFps(boolean value) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean("EmulationMenuSettings_ShowFps", value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean getSwapScreens() {
|
||||
return mPreferences.getBoolean("EmulationMenuSettings_SwapScreens", false);
|
||||
}
|
||||
|
||||
public static void setSwapScreens(boolean value) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean("EmulationMenuSettings_SwapScreens", value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean getShowOverlay() {
|
||||
return mPreferences.getBoolean("EmulationMenuSettings_ShowOverylay", true);
|
||||
}
|
||||
|
||||
public static void setShowOverlay(boolean value) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean("EmulationMenuSettings_ShowOverylay", value);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.yuzu.yuzu_emu.utils
|
||||
|
||||
import androidx.preference.PreferenceManager
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||
|
||||
object EmulationMenuSettings {
|
||||
private val preferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
||||
|
||||
// These must match what is defined in src/core/settings.h
|
||||
const val LayoutOption_Default = 0
|
||||
const val LayoutOption_SingleScreen = 1
|
||||
const val LayoutOption_LargeScreen = 2
|
||||
const val LayoutOption_SideScreen = 3
|
||||
const val LayoutOption_MobilePortrait = 4
|
||||
const val LayoutOption_MobileLandscape = 5
|
||||
|
||||
var joystickRelCenter: Boolean
|
||||
get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, true)
|
||||
set(value) {
|
||||
preferences.edit()
|
||||
.putBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, value)
|
||||
.apply()
|
||||
}
|
||||
var dpadSlideEnable: Boolean
|
||||
get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, true)
|
||||
set(value) {
|
||||
preferences.edit()
|
||||
.putBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, value)
|
||||
.apply()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
var landscapeScreenLayout: Int
|
||||
get() = preferences.getInt(
|
||||
Settings.PREF_MENU_SETTINGS_LANDSCAPE,
|
||||
LayoutOption_MobileLandscape
|
||||
)
|
||||
set(value) {
|
||||
preferences.edit()
|
||||
.putInt(Settings.PREF_MENU_SETTINGS_LANDSCAPE, value)
|
||||
.apply()
|
||||
}
|
||||
var showFps: Boolean
|
||||
get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, false)
|
||||
set(value) {
|
||||
preferences.edit()
|
||||
.putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, value)
|
||||
.apply()
|
||||
}
|
||||
var showOverlay: Boolean
|
||||
get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_OVERLAY, true)
|
||||
set(value) {
|
||||
preferences.edit()
|
||||
.putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_OVERLAY, value)
|
||||
.apply()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue