Android: Convert InputStringSetting to Kotlin

This commit is contained in:
Charles Lombardo 2023-03-15 03:27:14 -04:00
parent fc97c4d35a
commit 826e849a7b
2 changed files with 29 additions and 72 deletions

View File

@ -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.AbstractSetting;
import org.dolphinemu.dolphinemu.features.settings.model.AbstractStringSetting;
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
public class InputStringSetting extends SettingsItem
{
private AbstractStringSetting mSetting;
private MenuTag mMenuTag;
public InputStringSetting(Context context, AbstractStringSetting setting, int titleId,
int descriptionId, MenuTag menuTag)
{
super(context, titleId, descriptionId);
mSetting = setting;
mMenuTag = menuTag;
}
public InputStringSetting(Context context, AbstractStringSetting setting, int titleId,
int descriptionId)
{
this(context, setting, titleId, descriptionId, null);
}
public InputStringSetting(Context context, AbstractStringSetting setting, int titleId,
int descriptionId, int choicesId, int valuesId, MenuTag menuTag)
{
super(context, titleId, descriptionId);
mSetting = setting;
mMenuTag = menuTag;
}
public InputStringSetting(Context context, AbstractStringSetting setting, int titleId,
int descriptionId, int choicesId, int valuesId)
{
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
}
public String getSelectedValue()
{
return mSetting.getString();
}
public MenuTag getMenuTag()
{
return mMenuTag;
}
public void setSelectedValue(Settings settings, String selection)
{
mSetting.setString(settings, selection);
}
@Override
public int getType()
{
return TYPE_STRING;
}
@Override
public AbstractSetting getSetting()
{
return mSetting;
}
}

View File

@ -0,0 +1,29 @@
// 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.AbstractSetting
import org.dolphinemu.dolphinemu.features.settings.model.AbstractStringSetting
import org.dolphinemu.dolphinemu.features.settings.model.Settings
class InputStringSetting(
context: Context,
setting: AbstractStringSetting,
titleId: Int,
descriptionId: Int,
) : SettingsItem(context, titleId, descriptionId) {
override val type: Int = TYPE_STRING
private var stringSetting: AbstractStringSetting = setting
override val setting: AbstractSetting
get() = stringSetting
val selectedValue: String
get() = stringSetting.string
fun setSelectedValue(settings: Settings, selection: String) {
stringSetting.setString(settings, selection)
}
}