summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-03-07 21:38:44 +0100
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:35 +0200
commit21841b65206bd960d98586283d716e3351445caf (patch)
treeb3528a36beff82468f7a5709b6c2563fbb7d64a1 /src
parentandroid: Convert CheckBoxSetting to Kotlin (diff)
downloadyuzu-21841b65206bd960d98586283d716e3351445caf.tar
yuzu-21841b65206bd960d98586283d716e3351445caf.tar.gz
yuzu-21841b65206bd960d98586283d716e3351445caf.tar.bz2
yuzu-21841b65206bd960d98586283d716e3351445caf.tar.lz
yuzu-21841b65206bd960d98586283d716e3351445caf.tar.xz
yuzu-21841b65206bd960d98586283d716e3351445caf.tar.zst
yuzu-21841b65206bd960d98586283d716e3351445caf.zip
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.java40
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.kt35
2 files changed, 35 insertions, 40 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.java
deleted file mode 100644
index 17b2f1188..000000000
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.yuzu.yuzu_emu.features.settings.model.view;
-
-import org.yuzu.yuzu_emu.features.settings.model.Setting;
-import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
-
-public final class DateTimeSetting extends SettingsItem {
- private String mDefaultValue;
-
- public DateTimeSetting(String key, String section, int titleId, int descriptionId,
- String defaultValue, Setting setting) {
- super(key, section, setting, titleId, descriptionId);
- mDefaultValue = defaultValue;
- }
-
- public String getValue() {
- if (getSetting() != null) {
- StringSetting setting = (StringSetting) getSetting();
- return setting.getValue();
- } else {
- return mDefaultValue;
- }
- }
-
- public StringSetting setSelectedValue(String datetime) {
- if (getSetting() == null) {
- StringSetting setting = new StringSetting(getKey(), getSection(), datetime);
- setSetting(setting);
- return setting;
- } else {
- StringSetting setting = (StringSetting) getSetting();
- setting.setValue(datetime);
- return null;
- }
- }
-
- @Override
- public int getType() {
- return TYPE_DATETIME_SETTING;
- }
-} \ No newline at end of file
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.kt
new file mode 100644
index 000000000..a3388468d
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.kt
@@ -0,0 +1,35 @@
+package org.yuzu.yuzu_emu.features.settings.model.view
+
+import org.yuzu.yuzu_emu.features.settings.model.Setting
+import org.yuzu.yuzu_emu.features.settings.model.StringSetting
+
+class DateTimeSetting(
+ key: String,
+ section: String,
+ titleId: Int,
+ descriptionId: Int,
+ private val defaultValue: String,
+ setting: Setting
+) : SettingsItem(key, section, setting, titleId, descriptionId) {
+ override val type = TYPE_DATETIME_SETTING
+
+ val value: String
+ get() = if (setting != null) {
+ val setting = setting as StringSetting
+ setting.value
+ } else {
+ defaultValue
+ }
+
+ fun setSelectedValue(datetime: String): StringSetting? {
+ return if (setting == null) {
+ val newSetting = StringSetting(key!!, section!!, datetime)
+ setting = newSetting
+ newSetting
+ } else {
+ val newSetting = setting as StringSetting
+ newSetting.value = datetime
+ null
+ }
+ }
+}