From cb9c670d85f3d35c9c5be9207d4a203c300d8783 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sat, 10 Jun 2023 05:15:23 -0400 Subject: [PATCH] Android: Convert InputMappingIntSetting to Kotlin --- .../input/model/InputMappingIntSetting.java | 50 ------------------- .../input/model/InputMappingIntSetting.kt | 23 +++++++++ 2 files changed, 23 insertions(+), 50 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.kt diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.java deleted file mode 100644 index 176346c63a..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.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.AbstractIntSetting; -import org.dolphinemu.dolphinemu.features.settings.model.Settings; - -public class InputMappingIntSetting implements AbstractIntSetting -{ - private final NumericSetting mNumericSetting; - - public InputMappingIntSetting(NumericSetting numericSetting) - { - mNumericSetting = numericSetting; - } - - @Override - public int getInt() - { - return mNumericSetting.getIntValue(); - } - - @Override - public void setInt(@NonNull Settings settings, int newValue) - { - mNumericSetting.setIntValue(newValue); - } - - @Override - public boolean isOverridden() - { - return false; - } - - @Override - public boolean isRuntimeEditable() - { - return true; - } - - @Override - public boolean delete(@NonNull Settings settings) - { - mNumericSetting.setIntValue(mNumericSetting.getIntDefaultValue()); - return true; - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.kt new file mode 100644 index 0000000000..3e8a14afc7 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/InputMappingIntSetting.kt @@ -0,0 +1,23 @@ +// 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.AbstractIntSetting +import org.dolphinemu.dolphinemu.features.settings.model.Settings + +class InputMappingIntSetting(private val numericSetting: NumericSetting) : AbstractIntSetting { + override val int: Int + get() = numericSetting.getIntValue() + + override fun setInt(settings: Settings, newValue: Int) = numericSetting.setIntValue(newValue) + + override val isOverridden: Boolean = false + + override val isRuntimeEditable: Boolean = true + + override fun delete(settings: Settings): Boolean { + numericSetting.setIntValue(numericSetting.getIntDefaultValue()) + return true + } +}