Android: Convert SingleChoiceSetting to Kotlin
This commit is contained in:
parent
1fc9f03b27
commit
d51f504629
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue