From d51f504629d0b04d9b765a5aa8f0d978bf8f6a31 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Wed, 15 Mar 2023 03:28:49 -0400 Subject: [PATCH] Android: Convert SingleChoiceSetting to Kotlin --- .../model/view/SingleChoiceSetting.java | 72 ------------------- .../model/view/SingleChoiceSetting.kt | 30 ++++++++ 2 files changed, 30 insertions(+), 72 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.java deleted file mode 100644 index 1569785cd3..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.java +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.settings.model.view; - -import android.content.Context; - -import org.dolphinemu.dolphinemu.features.settings.model.AbstractIntSetting; -import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; -import org.dolphinemu.dolphinemu.features.settings.model.Settings; -import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; - -public final class SingleChoiceSetting extends SettingsItem -{ - private AbstractIntSetting mSetting; - - private int mChoicesId; - private int mValuesId; - private MenuTag menuTag; - - public SingleChoiceSetting(Context context, AbstractIntSetting setting, int titleId, - int descriptionId, int choicesId, int valuesId, MenuTag menuTag) - { - super(context, titleId, descriptionId); - mSetting = setting; - mValuesId = valuesId; - mChoicesId = choicesId; - this.menuTag = menuTag; - } - - public SingleChoiceSetting(Context context, AbstractIntSetting setting, int titleId, - int descriptionId, int choicesId, int valuesId) - { - this(context, setting, titleId, descriptionId, choicesId, valuesId, null); - } - - public int getChoicesId() - { - return mChoicesId; - } - - public int getValuesId() - { - return mValuesId; - } - - public int getSelectedValue() - { - return mSetting.getInt(); - } - - public MenuTag getMenuTag() - { - return menuTag; - } - - public void setSelectedValue(Settings settings, int selection) - { - mSetting.setInt(settings, selection); - } - - @Override - public int getType() - { - return TYPE_SINGLE_CHOICE; - } - - @Override - public AbstractSetting getSetting() - { - return mSetting; - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt new file mode 100644 index 0000000000..cd9f3ddb64 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +package org.dolphinemu.dolphinemu.features.settings.model.view + +import android.content.Context +import org.dolphinemu.dolphinemu.features.settings.model.AbstractIntSetting +import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting +import org.dolphinemu.dolphinemu.features.settings.model.Settings +import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag + +class SingleChoiceSetting( + context: Context, + private val intSetting: AbstractIntSetting, + titleId: Int, + descriptionId: Int, + val choicesId: Int, + val valuesId: Int, + val menuTag: MenuTag? = null +) : SettingsItem(context, titleId, descriptionId) { + override val type: Int = TYPE_SINGLE_CHOICE + + override val setting: AbstractSetting + get() = intSetting + + val selectedValue: Int + get() = intSetting.int + + fun setSelectedValue(settings: Settings?, selection: Int) { + intSetting.setInt(settings!!, selection) + } +}