From d21b2d86a8eb16b2f9575ee85a4cbc4ef2d489a0 Mon Sep 17 00:00:00 2001 From: Charles Lombardo <clombardo169@gmail.com> Date: Sat, 10 Jun 2023 05:16:27 -0400 Subject: [PATCH] Android: Convert InputMappingControlSetting to Kotlin --- .../view/InputMappingControlSetting.java | 71 ------------------- .../model/view/InputMappingControlSetting.kt | 33 +++++++++ 2 files changed, 33 insertions(+), 71 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.kt diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java deleted file mode 100644 index 86379bf5a6..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java +++ /dev/null @@ -1,71 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.input.model.view; - -import org.dolphinemu.dolphinemu.features.input.model.controlleremu.Control; -import org.dolphinemu.dolphinemu.features.input.model.controlleremu.ControlReference; -import org.dolphinemu.dolphinemu.features.input.model.controlleremu.EmulatedController; -import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; -import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; - -public final class InputMappingControlSetting extends SettingsItem -{ - private final ControlReference mControlReference; - private final EmulatedController mController; - - public InputMappingControlSetting(Control control, EmulatedController controller) - { - super(control.getUiName(), ""); - mControlReference = control.getControlReference(); - mController = controller; - } - - public String getValue() - { - return mControlReference.getExpression(); - } - - public void setValue(String expr) - { - mControlReference.setExpression(expr); - mController.updateSingleControlReference(mControlReference); - } - - public void clearValue() - { - setValue(""); - } - - @Override - public int getType() - { - return TYPE_INPUT_MAPPING_CONTROL; - } - - @Override - public AbstractSetting getSetting() - { - return null; - } - - @Override - public boolean isEditable() - { - return true; - } - - public EmulatedController getController() - { - return mController; - } - - public ControlReference getControlReference() - { - return mControlReference; - } - - public boolean isInput() - { - return mControlReference.isInput(); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.kt new file mode 100644 index 0000000000..26a86a9411 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.kt @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.input.model.view + +import org.dolphinemu.dolphinemu.features.input.model.controlleremu.Control +import org.dolphinemu.dolphinemu.features.input.model.controlleremu.EmulatedController +import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting +import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem + +class InputMappingControlSetting(var control: Control, val controller: EmulatedController) : + SettingsItem(control.getUiName(), "") { + val controlReference get() = control.getControlReference() + + var value: String + get() = controlReference.getExpression() + set(expr) { + controlReference.setExpression(expr) + controller.updateSingleControlReference(controlReference) + } + + fun clearValue() { + value = "" + } + + override val type: Int = TYPE_INPUT_MAPPING_CONTROL + + override val setting: AbstractSetting? = null + + override val isEditable: Boolean = true + + val isInput: Boolean + get() = controlReference.isInput() +}