Android: Convert SwitchSetting to Kotlin
This commit is contained in:
parent
ab11b44938
commit
2af8efdd72
|
@ -1,50 +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.AbstractBooleanSetting;
|
|
||||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
|
||||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
|
||||||
|
|
||||||
public class SwitchSetting extends SettingsItem
|
|
||||||
{
|
|
||||||
protected AbstractBooleanSetting mSetting;
|
|
||||||
|
|
||||||
public SwitchSetting(Context context, AbstractBooleanSetting setting, int titleId,
|
|
||||||
int descriptionId)
|
|
||||||
{
|
|
||||||
super(context, titleId, descriptionId);
|
|
||||||
mSetting = setting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SwitchSetting(AbstractBooleanSetting setting, CharSequence title,
|
|
||||||
CharSequence description)
|
|
||||||
{
|
|
||||||
super(title, description);
|
|
||||||
mSetting = setting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isChecked()
|
|
||||||
{
|
|
||||||
return mSetting.getBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChecked(Settings settings, boolean checked)
|
|
||||||
{
|
|
||||||
mSetting.setBoolean(settings, checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType()
|
|
||||||
{
|
|
||||||
return TYPE_SWITCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractSetting getSetting()
|
|
||||||
{
|
|
||||||
return mSetting;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
// 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.AbstractBooleanSetting
|
||||||
|
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting
|
||||||
|
import org.dolphinemu.dolphinemu.features.settings.model.Settings
|
||||||
|
|
||||||
|
open class SwitchSetting : SettingsItem {
|
||||||
|
override val type: Int = TYPE_SWITCH
|
||||||
|
|
||||||
|
protected var booleanSetting: AbstractBooleanSetting
|
||||||
|
|
||||||
|
override val setting: AbstractSetting
|
||||||
|
get() = booleanSetting
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
context: Context,
|
||||||
|
setting: AbstractBooleanSetting,
|
||||||
|
titleId: Int,
|
||||||
|
descriptionId: Int
|
||||||
|
) : super(context, titleId, descriptionId) {
|
||||||
|
booleanSetting = setting
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
setting: AbstractBooleanSetting,
|
||||||
|
title: CharSequence?,
|
||||||
|
description: CharSequence?
|
||||||
|
) : super(title!!, description) {
|
||||||
|
booleanSetting = setting
|
||||||
|
}
|
||||||
|
|
||||||
|
open val isChecked: Boolean
|
||||||
|
get() = booleanSetting.boolean
|
||||||
|
|
||||||
|
open fun setChecked(settings: Settings?, checked: Boolean) {
|
||||||
|
booleanSetting.setBoolean(settings!!, checked)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue