Simple Mercies 1.1: tap the question for a different one

This commit is contained in:
2026-10-19 02:57:13 +00:00
parent cc823e4cf6
commit 36c37a722b
@@ -73,6 +73,8 @@ class Prefs private constructor(ctx: Context) {
private val _mornH = mutableIntStateOf(p.getInt("mornH", 7)) private val _mornH = mutableIntStateOf(p.getInt("mornH", 7))
private val _mornM = mutableIntStateOf(p.getInt("mornM", 45)) private val _mornM = mutableIntStateOf(p.getInt("mornM", 45))
private val _shake = mutableStateOf(p.getBoolean("shake", true)) private val _shake = mutableStateOf(p.getBoolean("shake", true))
private val _promptDay = mutableStateOf(p.getString("promptDay", "") ?: "")
private val _promptShift = mutableIntStateOf(p.getInt("promptShift", 0))
var look: Int get() = _look.intValue; set(v) { _look.intValue = v; p.edit().putInt("look", v).apply() } var look: Int get() = _look.intValue; set(v) { _look.intValue = v; p.edit().putInt("look", v).apply() }
var night: Boolean get() = _night.value; set(v) { _night.value = v; p.edit().putBoolean("night", v).apply() } var night: Boolean get() = _night.value; set(v) { _night.value = v; p.edit().putBoolean("night", v).apply() }
@@ -85,6 +87,15 @@ class Prefs private constructor(ctx: Context) {
var mornM: Int get() = _mornM.intValue; set(v) { _mornM.intValue = v; p.edit().putInt("mornM", v).apply() } var mornM: Int get() = _mornM.intValue; set(v) { _mornM.intValue = v; p.edit().putInt("mornM", v).apply() }
var shake: Boolean get() = _shake.value; set(v) { _shake.value = v; p.edit().putBoolean("shake", v).apply() } var shake: Boolean get() = _shake.value; set(v) { _shake.value = v; p.edit().putBoolean("shake", v).apply() }
/** how many times today's question has been swapped; 0 on a new day */
val promptShift: Int get() = if (_promptDay.value == java.time.LocalDate.now().toString()) _promptShift.intValue else 0
fun nextPrompt() {
val today = java.time.LocalDate.now().toString()
val n = promptShift + 1
_promptDay.value = today; _promptShift.intValue = n
p.edit().putString("promptDay", today).putInt("promptShift", n).apply()
}
val active: Look get() = Looks.all[if (night) 3 else look.coerceIn(0, 2)] val active: Look get() = Looks.all[if (night) 3 else look.coerceIn(0, 2)]
companion object { companion object {