From 56c33890b903147bf88078cec12a5179fa4b99e0 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Wed, 15 Mar 2023 03:27:40 -0400 Subject: [PATCH] Android: Convert InvertedSwitchSetting to Kotlin --- .../model/view/InvertedSwitchSetting.java | 36 ------------------- .../model/view/InvertedSwitchSetting.kt | 25 +++++++++++++ 2 files changed, 25 insertions(+), 36 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.java deleted file mode 100644 index 621530e980..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.java +++ /dev/null @@ -1,36 +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 final class InvertedSwitchSetting extends SwitchSetting -{ - public InvertedSwitchSetting(Context context, AbstractBooleanSetting setting, int titleId, - int descriptionId) - { - super(context, setting, titleId, descriptionId); - } - - @Override - public boolean isChecked() - { - return !mSetting.getBoolean(); - } - - @Override - public void setChecked(Settings settings, boolean checked) - { - mSetting.setBoolean(settings, !checked); - } - - @Override - public AbstractSetting getSetting() - { - return mSetting; - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt new file mode 100644 index 0000000000..1a423c62f5 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt @@ -0,0 +1,25 @@ +// 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 + +class InvertedSwitchSetting( + context: Context, + setting: AbstractBooleanSetting, + titleId: Int, + descriptionId: Int +) : SwitchSetting(context, setting, titleId, descriptionId) { + override val setting: AbstractSetting + get() = booleanSetting + + override val isChecked: Boolean + get() = !booleanSetting.boolean + + override fun setChecked(settings: Settings?, checked: Boolean) { + booleanSetting.setBoolean(settings!!, !checked) + } +}