summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
+ }
+ }
+}