mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Android: Convert ControlGroupEnabledSetting to Kotlin
This commit is contained in:
parent
260bad74ea
commit
0454578f45
@ -1,52 +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.ControlGroup;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
public class ControlGroupEnabledSetting implements AbstractBooleanSetting
|
||||
{
|
||||
private final ControlGroup mControlGroup;
|
||||
|
||||
public ControlGroupEnabledSetting(ControlGroup controlGroup)
|
||||
{
|
||||
mControlGroup = controlGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean()
|
||||
{
|
||||
return mControlGroup.getEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(@NonNull Settings settings, boolean newValue)
|
||||
{
|
||||
mControlGroup.setEnabled(newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuntimeEditable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(@NonNull Settings settings)
|
||||
{
|
||||
boolean newValue = mControlGroup.getDefaultEnabledValue() != ControlGroup.DEFAULT_ENABLED_NO;
|
||||
mControlGroup.setEnabled(newValue);
|
||||
|
||||
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.ControlGroup
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings
|
||||
|
||||
class ControlGroupEnabledSetting(private val controlGroup: ControlGroup) : AbstractBooleanSetting {
|
||||
override val boolean: Boolean
|
||||
get() = controlGroup.getEnabled()
|
||||
|
||||
override fun setBoolean(settings: Settings, newValue: Boolean) =
|
||||
controlGroup.setEnabled(newValue)
|
||||
|
||||
override val isOverridden: Boolean = false
|
||||
|
||||
override val isRuntimeEditable: Boolean = true
|
||||
|
||||
override fun delete(settings: Settings): Boolean {
|
||||
val newValue = controlGroup.getDefaultEnabledValue() != ControlGroup.DEFAULT_ENABLED_NO
|
||||
controlGroup.setEnabled(newValue)
|
||||
return true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user