Exverge
82e47a196e
Some checks failed
suyu-ci / Check REUSE Specification (push) Has been cancelled
codespell / Check for spelling errors (push) Has been cancelled
suyu verify / Verify Format (push) Has been cancelled
suyu verify / test build (linux-fresh, clang) (push) Has been cancelled
suyu verify / test build (linux-fresh, linux) (push) Has been cancelled
suyu verify / test build (linux-mingw, windows) (push) Has been cancelled
suyu verify / android (push) Has been cancelled
I'll add the relevant "2024 suyu Emulator" notices soon
35 lines
1.2 KiB
Kotlin
35 lines
1.2 KiB
Kotlin
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
package org.suyu.suyu_emu.features.settings.model.view
|
|
|
|
import androidx.annotation.StringRes
|
|
import org.suyu.suyu_emu.features.settings.model.AbstractBooleanSetting
|
|
import org.suyu.suyu_emu.features.settings.model.AbstractIntSetting
|
|
import org.suyu.suyu_emu.features.settings.model.AbstractSetting
|
|
|
|
class SwitchSetting(
|
|
setting: AbstractSetting,
|
|
@StringRes titleId: Int = 0,
|
|
titleString: String = "",
|
|
@StringRes descriptionId: Int = 0,
|
|
descriptionString: String = ""
|
|
) : SettingsItem(setting, titleId, titleString, descriptionId, descriptionString) {
|
|
override val type = TYPE_SWITCH
|
|
|
|
fun getIsChecked(needsGlobal: Boolean = false): Boolean {
|
|
return when (setting) {
|
|
is AbstractIntSetting -> setting.getInt(needsGlobal) == 1
|
|
is AbstractBooleanSetting -> setting.getBoolean(needsGlobal)
|
|
else -> false
|
|
}
|
|
}
|
|
|
|
fun setChecked(value: Boolean) {
|
|
when (setting) {
|
|
is AbstractIntSetting -> setting.setInt(if (value) 1 else 0)
|
|
is AbstractBooleanSetting -> setting.setBoolean(value)
|
|
}
|
|
}
|
|
}
|