Android: Convert InputMappingBooleanSetting to Kotlin
This commit is contained in:
parent
4c8cd49d80
commit
b2e2c3b8d4
|
@ -1,50 +0,0 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.features.input.model;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting;
|
|
||||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting;
|
|
||||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
|
||||||
|
|
||||||
public class InputMappingBooleanSetting implements AbstractBooleanSetting
|
|
||||||
{
|
|
||||||
private final NumericSetting mNumericSetting;
|
|
||||||
|
|
||||||
public InputMappingBooleanSetting(NumericSetting numericSetting)
|
|
||||||
{
|
|
||||||
mNumericSetting = numericSetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getBoolean()
|
|
||||||
{
|
|
||||||
return mNumericSetting.getBooleanValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBoolean(@NonNull Settings settings, boolean newValue)
|
|
||||||
{
|
|
||||||
mNumericSetting.setBooleanValue(newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOverridden()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRuntimeEditable()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean delete(@NonNull Settings settings)
|
|
||||||
{
|
|
||||||
mNumericSetting.setBooleanValue(mNumericSetting.getBooleanDefaultValue());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
package org.dolphinemu.dolphinemu.features.input.model
|
||||||
|
|
||||||
|
import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting
|
||||||
|
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting
|
||||||
|
import org.dolphinemu.dolphinemu.features.settings.model.Settings
|
||||||
|
|
||||||
|
class InputMappingBooleanSetting(private val numericSetting: NumericSetting) :
|
||||||
|
AbstractBooleanSetting {
|
||||||
|
override val boolean: Boolean
|
||||||
|
get() = numericSetting.getBooleanValue()
|
||||||
|
|
||||||
|
override fun setBoolean(settings: Settings, newValue: Boolean) =
|
||||||
|
numericSetting.setBooleanValue(newValue)
|
||||||
|
|
||||||
|
override val isOverridden: Boolean = false
|
||||||
|
|
||||||
|
override val isRuntimeEditable: Boolean = true
|
||||||
|
|
||||||
|
override fun delete(settings: Settings): Boolean {
|
||||||
|
numericSetting.setBooleanValue(numericSetting.getBooleanDefaultValue())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue