Android: Convert InputMappingBooleanSetting to Kotlin

This commit is contained in:
Charles Lombardo 2023-06-10 05:14:56 -04:00
parent 4c8cd49d80
commit b2e2c3b8d4
2 changed files with 25 additions and 50 deletions

View File

@ -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;
}
}

View File

@ -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
}
}