From b2e2c3b8d4c24dd79fab4f59ed8ac811c2be0f01 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sat, 10 Jun 2023 05:14:56 -0400 Subject: [PATCH] Android: Convert InputMappingBooleanSetting to Kotlin --- .../model/InputMappingBooleanSetting.java | 50 ------------------- .../input/model/InputMappingBooleanSetting.kt | 25 ++++++++++ 2 files changed, 25 insertions(+), 50 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.kt diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.java deleted file mode 100644 index 6e80fef6dd..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.java +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.input.model; - -import androidx.annotation.NonNull; - -import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting; -import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting; -import org.dolphinemu.dolphinemu.features.settings.model.Settings; - -public class InputMappingBooleanSetting implements AbstractBooleanSetting -{ - private final NumericSetting mNumericSetting; - - public InputMappingBooleanSetting(NumericSetting numericSetting) - { - mNumericSetting = numericSetting; - } - - @Override - public boolean getBoolean() - { - return mNumericSetting.getBooleanValue(); - } - - @Override - public void setBoolean(@NonNull Settings settings, boolean newValue) - { - mNumericSetting.setBooleanValue(newValue); - } - - @Override - public boolean isOverridden() - { - return false; - } - - @Override - public boolean isRuntimeEditable() - { - return true; - } - - @Override - public boolean delete(@NonNull Settings settings) - { - mNumericSetting.setBooleanValue(mNumericSetting.getBooleanDefaultValue()); - return true; - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.kt new file mode 100644 index 0000000000..5771db54e0 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingBooleanSetting.kt @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.input.model + +import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting +import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting +import org.dolphinemu.dolphinemu.features.settings.model.Settings + +class InputMappingBooleanSetting(private val numericSetting: NumericSetting) : + AbstractBooleanSetting { + override val boolean: Boolean + get() = numericSetting.getBooleanValue() + + override fun setBoolean(settings: Settings, newValue: Boolean) = + numericSetting.setBooleanValue(newValue) + + override val isOverridden: Boolean = false + + override val isRuntimeEditable: Boolean = true + + override fun delete(settings: Settings): Boolean { + numericSetting.setBooleanValue(numericSetting.getBooleanDefaultValue()) + return true + } +}