diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.java deleted file mode 100644 index c12bc51ca0..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.java +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.settings.model; - -import androidx.annotation.NonNull; - -public class AdHocBooleanSetting implements AbstractBooleanSetting -{ - private final String mFile; - private final String mSection; - private final String mKey; - private final boolean mDefaultValue; - - public AdHocBooleanSetting(String file, String section, String key, boolean defaultValue) - { - mFile = file; - mSection = section; - mKey = key; - mDefaultValue = defaultValue; - - if (!NativeConfig.isSettingSaveable(file, section, key)) - { - throw new IllegalArgumentException("File/section/key is unknown or legacy"); - } - } - - @Override - public boolean isOverridden() - { - return NativeConfig.isOverridden(mFile, mSection, mKey); - } - - @Override - public boolean isRuntimeEditable() - { - return true; - } - - @Override - public boolean delete(@NonNull Settings settings) - { - return NativeConfig.deleteKey(settings.getWriteLayer(), mFile, mSection, mKey); - } - - @Override - public boolean getBoolean() - { - return NativeConfig.getBoolean(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue); - } - - @Override - public void setBoolean(@NonNull Settings settings, boolean newValue) - { - NativeConfig.setBoolean(settings.getWriteLayer(), mFile, mSection, mKey, newValue); - } - - public static boolean getBooleanGlobal(String file, String section, String key, - boolean defaultValue) - { - return NativeConfig.getBoolean(NativeConfig.LAYER_ACTIVE, file, section, key, defaultValue); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.kt new file mode 100644 index 0000000000..f62ead3251 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.kt @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.settings.model + +class AdHocBooleanSetting( + private val file: String, + private val section: String, + private val key: String, + private val defaultValue: Boolean +) : AbstractBooleanSetting { + init { + require( + NativeConfig.isSettingSaveable( + file, + section, + key + ) + ) { "File/section/key is unknown or legacy" } + } + + override val isOverridden: Boolean + get() = NativeConfig.isOverridden(file, section, key) + + override val isRuntimeEditable: Boolean = true + + override fun delete(settings: Settings): Boolean { + return NativeConfig.deleteKey(settings.writeLayer, file, section, key) + } + + override val boolean: Boolean + get() = NativeConfig.getBoolean(NativeConfig.LAYER_ACTIVE, file, section, key, defaultValue) + + override fun setBoolean(settings: Settings, newValue: Boolean) { + NativeConfig.setBoolean(settings.writeLayer, file, section, key, newValue) + } +}