0.41.0 (76): Keep screen on toggle (Android and iOS)

Settings › Interface: Android sets FLAG_KEEP_SCREEN_ON on the window, iOS turns
the idle timer off; persisted (and in iOS backups).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Reactorcoremeltdown
2026-11-17 20:15:46 +01:00
co-authored by Claude Opus 5.5
parent 6939dccbf0
commit cdabf3018b
10 changed files with 64 additions and 4 deletions
+5
View File
@@ -5,6 +5,11 @@ version in `versions.properties`; versions before 0.28.0 are described in the gi
log (one commit per version). Since 0.37.0 Android and iOS share one version and log (one commit per version). Since 0.37.0 Android and iOS share one version and
one feature set; the iOS side of each version is in `ios/CHANGELOG.md`. one feature set; the iOS side of each version is in `ios/CHANGELOG.md`.
## 0.41.0 (versionCode 76)
- **Keep screen on:** a Settings › Interface toggle that stops the screen from
dimming or locking while Sizzle is open (remembered). (iOS has the same in 0.41.0.)
## 0.40.0 (versionCode 75) ## 0.40.0 (versionCode 75)
- **Sampler One-shot:** a ONE-SHOT toggle at the top of the Sampler editor. On, - **Sampler One-shot:** a ONE-SHOT toggle at the top of the Sampler editor. On,
@@ -83,6 +83,12 @@ class MainActivity : ComponentActivity() {
SizzleTheme(palette = viewModel.palette) { SizzleTheme(palette = viewModel.palette) {
SizzleAppUi(viewModel) SizzleAppUi(viewModel)
} }
// "Keep screen on" (Settings › Interface): the window's flag follows the setting.
val keepOn = viewModel.keepScreenOn
androidx.compose.runtime.LaunchedEffect(keepOn) {
if (keepOn) window.addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
else window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
} }
// Hold the MIDI ports (USB, Bluetooth, other apps' virtual devices) for the // Hold the MIDI ports (USB, Bluetooth, other apps' virtual devices) for the
@@ -30,6 +30,8 @@ data class AppSettings(
val kbdOctave: Int = 3, val kbdOctave: Int = 3,
/** Show the live VU meters inside the mixer volume faders. */ /** Show the live VU meters inside the mixer volume faders. */
val vuMeters: Boolean = true, val vuMeters: Boolean = true,
/** Keep the screen on while Sizzle is in front. */
val keepScreenOn: Boolean = false,
/** Send MIDI clock + start/stop to attached MIDI devices (drive external gear). */ /** Send MIDI clock + start/stop to attached MIDI devices (drive external gear). */
val sendMidiClock: Boolean = false, val sendMidiClock: Boolean = false,
/** Follow an external MIDI clock's tempo + start/stop. */ /** Follow an external MIDI clock's tempo + start/stop. */
@@ -63,6 +65,7 @@ class SettingsStore(private val context: Context) {
kbdChannel = prefs[KBD_CHANNEL] ?: 0, kbdChannel = prefs[KBD_CHANNEL] ?: 0,
kbdOctave = prefs[KBD_OCTAVE] ?: 3, kbdOctave = prefs[KBD_OCTAVE] ?: 3,
vuMeters = prefs[VU_METERS] ?: true, vuMeters = prefs[VU_METERS] ?: true,
keepScreenOn = prefs[KEEP_SCREEN_ON] ?: false,
sendMidiClock = prefs[MIDI_CLOCK_SEND] ?: false, sendMidiClock = prefs[MIDI_CLOCK_SEND] ?: false,
receiveMidiClock = prefs[MIDI_CLOCK_RECV] ?: false, receiveMidiClock = prefs[MIDI_CLOCK_RECV] ?: false,
soundModule = prefs[SOUND_MODULE] ?: false, soundModule = prefs[SOUND_MODULE] ?: false,
@@ -102,6 +105,11 @@ class SettingsStore(private val context: Context) {
context.settingsDataStore.edit { prefs -> prefs[VU_METERS] = enabled } context.settingsDataStore.edit { prefs -> prefs[VU_METERS] = enabled }
} }
/** Persist "Keep screen on". */
suspend fun saveKeepScreenOn(enabled: Boolean) {
context.settingsDataStore.edit { prefs -> prefs[KEEP_SCREEN_ON] = enabled }
}
/** Persist the MIDI-clock send / receive toggles. */ /** Persist the MIDI-clock send / receive toggles. */
suspend fun saveMidiClock(send: Boolean, receive: Boolean) { suspend fun saveMidiClock(send: Boolean, receive: Boolean) {
context.settingsDataStore.edit { prefs -> context.settingsDataStore.edit { prefs ->
@@ -132,6 +140,7 @@ class SettingsStore(private val context: Context) {
val KBD_CHANNEL = intPreferencesKey("kbdChannel") val KBD_CHANNEL = intPreferencesKey("kbdChannel")
val KBD_OCTAVE = intPreferencesKey("kbdOctave") val KBD_OCTAVE = intPreferencesKey("kbdOctave")
val VU_METERS = booleanPreferencesKey("vuMeters") val VU_METERS = booleanPreferencesKey("vuMeters")
val KEEP_SCREEN_ON = booleanPreferencesKey("keepScreenOn")
val MIDI_CLOCK_SEND = booleanPreferencesKey("midiClockSend") val MIDI_CLOCK_SEND = booleanPreferencesKey("midiClockSend")
val MIDI_CLOCK_RECV = booleanPreferencesKey("midiClockRecv") val MIDI_CLOCK_RECV = booleanPreferencesKey("midiClockRecv")
val SOUND_MODULE = booleanPreferencesKey("soundModule") val SOUND_MODULE = booleanPreferencesKey("soundModule")
@@ -117,6 +117,15 @@ class AppViewModel(
/** Whether the mixer's fader VU meters are shown (Settings toggle). */ /** Whether the mixer's fader VU meters are shown (Settings toggle). */
var vuMeters by mutableStateOf(true); private set var vuMeters by mutableStateOf(true); private set
/** Keep the screen on while Sizzle is in front (Settings toggle). */
var keepScreenOn by mutableStateOf(false); private set
fun updateKeepScreenOn(enabled: Boolean) {
keepScreenOn = enabled
viewModelScope.launch { settingsStore.saveKeepScreenOn(enabled) }
touched()
}
/** Enable/disable the mixer fader VU meters and persist the choice. */ /** Enable/disable the mixer fader VU meters and persist the choice. */
fun updateVuMeters(enabled: Boolean) { fun updateVuMeters(enabled: Boolean) {
vuMeters = enabled vuMeters = enabled
@@ -1098,6 +1107,7 @@ class AppViewModel(
kbdChannel = s.kbdChannel.coerceIn(0, Cell.MAX_CHANNEL) kbdChannel = s.kbdChannel.coerceIn(0, Cell.MAX_CHANNEL)
kbdOctave = s.kbdOctave.coerceIn(0, 8) kbdOctave = s.kbdOctave.coerceIn(0, 8)
vuMeters = s.vuMeters vuMeters = s.vuMeters
keepScreenOn = s.keepScreenOn
// MIDI clock sync: the transport/tempo follow and the send thread's // MIDI clock sync: the transport/tempo follow and the send thread's
// providers are wired in SizzleApp (they must work with no UI); here we // providers are wired in SizzleApp (they must work with no UI); here we
@@ -685,6 +685,12 @@ private fun InterfaceCard(vm: AppViewModel) {
"Show live level meters inside the mixer volume faders.", "Show live level meters inside the mixer volume faders.",
vm.vuMeters, vm.vuMeters,
) { vm.updateVuMeters(it) } ) { vm.updateVuMeters(it) }
HorizontalDivider()
ToggleRow(
"Keep screen on",
"Don't let the screen dim or lock while Sizzle is open.",
vm.keepScreenOn,
) { vm.updateKeepScreenOn(it) }
} }
} }
+5
View File
@@ -5,6 +5,11 @@ Sizzle for iOS/iPadOS (`cc.tiredsysadmin.ios.sizzle`). One entry per version in
is shared with Android, continuing Android's numbering, and both apps ship the is shared with Android, continuing Android's numbering, and both apps ship the
same features; the Android side of each version is in `../CHANGELOG.md`. same features; the Android side of each version is in `../CHANGELOG.md`.
## 0.41.0 (build 76)
- Keep screen on: a Setup › Interface toggle that turns the idle timer off while
Sizzle is open (remembered, and in backups). (Android has the same in 0.41.0.)
## 0.40.0 (build 75) ## 0.40.0 (build 75)
- Sampler One-shot: a ONE-SHOT toggle above the pad tools (also in the Sampler's - Sampler One-shot: a ONE-SHOT toggle above the pad tools (also in the Sampler's
+1
View File
@@ -12,6 +12,7 @@ enum AppBoot {
let session = SizzleSession.shared let session = SizzleSession.shared
session.recordTailBars = settings.recordTailBars session.recordTailBars = settings.recordTailBars
ThemeLibrary.shared.select(settings.paletteName) ThemeLibrary.shared.select(settings.paletteName)
settings.applyKeepScreenOn()
let input = InputController.shared let input = InputController.shared
input.app = AppModel.main input.app = AppModel.main
+17 -2
View File
@@ -2,6 +2,9 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import Foundation import Foundation
#if canImport(UIKit)
import UIKit
#endif
/// App-level settings that persist across launches (Android's SettingsStore and /// App-level settings that persist across launches (Android's SettingsStore and
/// BindingStore). Song, mixer and toolbox settings live in the project instead. /// BindingStore). Song, mixer and toolbox settings live in the project instead.
@@ -21,6 +24,16 @@ final class AppSettings: ObservableObject {
@Published var kbdOctave: Int { didSet { d.set(kbdOctave, forKey: "kbdOctave") } } @Published var kbdOctave: Int { didSet { d.set(kbdOctave, forKey: "kbdOctave") } }
/// The live meters inside the mixer's volume faders. /// The live meters inside the mixer's volume faders.
@Published var vuMeters: Bool { didSet { d.set(vuMeters, forKey: "vuMeters") } } @Published var vuMeters: Bool { didSet { d.set(vuMeters, forKey: "vuMeters") } }
/// Keep the screen on while Sizzle is in front (the idle timer off).
@Published var keepScreenOn: Bool {
didSet { d.set(keepScreenOn, forKey: "keepScreenOn"); applyKeepScreenOn() }
}
func applyKeepScreenOn() {
#if canImport(UIKit)
UIApplication.shared.isIdleTimerDisabled = keepScreenOn
#endif
}
/// Send MIDI clock, Start/Stop and the sequenced notes to MIDI destinations. /// Send MIDI clock, Start/Stop and the sequenced notes to MIDI destinations.
@Published var sendMidiClock: Bool { didSet { d.set(sendMidiClock, forKey: "midiClockSend") } } @Published var sendMidiClock: Bool { didSet { d.set(sendMidiClock, forKey: "midiClockSend") } }
/// Follow an external MIDI clock's tempo and Start/Stop. /// Follow an external MIDI clock's tempo and Start/Stop.
@@ -45,6 +58,7 @@ final class AppSettings: ObservableObject {
kbdChannel = d.object(forKey: "kbdChannel") as? Int ?? 1 kbdChannel = d.object(forKey: "kbdChannel") as? Int ?? 1
kbdOctave = d.object(forKey: "kbdOctave") as? Int ?? 3 kbdOctave = d.object(forKey: "kbdOctave") as? Int ?? 3
vuMeters = d.object(forKey: "vuMeters") as? Bool ?? true vuMeters = d.object(forKey: "vuMeters") as? Bool ?? true
keepScreenOn = d.bool(forKey: "keepScreenOn")
sendMidiClock = d.bool(forKey: "midiClockSend") sendMidiClock = d.bool(forKey: "midiClockSend")
receiveMidiClock = d.bool(forKey: "midiClockRecv") receiveMidiClock = d.bool(forKey: "midiClockRecv")
soundModule = d.bool(forKey: "soundModule") soundModule = d.bool(forKey: "soundModule")
@@ -61,7 +75,7 @@ final class AppSettings: ObservableObject {
// MARK: Backup text // MARK: Backup text
private static let keys = ["palette", "recordTailBars", "kbdChannel", "kbdOctave", "vuMeters", "midiClockSend", private static let keys = ["palette", "recordTailBars", "kbdChannel", "kbdOctave", "vuMeters", "midiClockSend",
"midiClockRecv", "soundModule", "midiSourcesOff", "bleMidiDevices", "bindKeyboard", "midiClockRecv", "soundModule", "keepScreenOn", "midiSourcesOff", "bleMidiDevices", "bindKeyboard",
"bindGamepad", "bindMidi"] "bindGamepad", "bindMidi"]
/// Every setting as `key=value` lines; multi-line values (bindings, the source /// Every setting as `key=value` lines; multi-line values (bindings, the source
@@ -73,7 +87,7 @@ final class AppSettings: ObservableObject {
let text: String let text: String
switch v { switch v {
case let a as [String]: text = a.joined(separator: "\n") case let a as [String]: text = a.joined(separator: "\n")
case let n as NSNumber where k == "vuMeters" || k.hasPrefix("midiClock") || k == "soundModule": text = n.boolValue ? "true" : "false" case let n as NSNumber where k == "vuMeters" || k.hasPrefix("midiClock") || k == "soundModule" || k == "keepScreenOn": text = n.boolValue ? "true" : "false"
default: text = "\(v)" default: text = "\(v)"
} }
lines.append(k + "=" + text.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "\n", with: "\\n")) lines.append(k + "=" + text.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "\n", with: "\\n"))
@@ -100,6 +114,7 @@ final class AppSettings: ObservableObject {
if let v = map["midiClockSend"] { sendMidiClock = v == "true" } if let v = map["midiClockSend"] { sendMidiClock = v == "true" }
if let v = map["midiClockRecv"] { receiveMidiClock = v == "true" } if let v = map["midiClockRecv"] { receiveMidiClock = v == "true" }
if let v = map["soundModule"] { soundModule = v == "true" } if let v = map["soundModule"] { soundModule = v == "true" }
if let v = map["keepScreenOn"] { keepScreenOn = v == "true" }
if let v = map["midiSourcesOff"] { midiSourcesOff = Set(v.split(separator: "\n").map(String.init)) } if let v = map["midiSourcesOff"] { midiSourcesOff = Set(v.split(separator: "\n").map(String.init)) }
if let v = map["bleMidiDevices"] { if let v = map["bleMidiDevices"] {
bleMidiDevices = Dictionary(v.split(separator: "\n").map { e -> (String, String) in bleMidiDevices = Dictionary(v.split(separator: "\n").map { e -> (String, String) in
@@ -62,6 +62,9 @@ struct InterfaceCard: View {
SetupCard(title: "Interface", subtitle: "On-screen display options") { SetupCard(title: "Interface", subtitle: "On-screen display options") {
SetupToggle(title: "Mixer VU meters", detail: "Show live level meters inside the mixer volume faders.", SetupToggle(title: "Mixer VU meters", detail: "Show live level meters inside the mixer volume faders.",
isOn: settings.vuMeters) { settings.vuMeters = $0 } isOn: settings.vuMeters) { settings.vuMeters = $0 }
SetupDivider()
SetupToggle(title: "Keep screen on", detail: "Don't let the screen dim or lock while Sizzle is open.",
isOn: settings.keepScreenOn) { settings.keepScreenOn = $0 }
} }
} }
} }
+2 -2
View File
@@ -12,8 +12,8 @@
# or polish. versionCode is monotonic and bumps by 1 on every release, # or polish. versionCode is monotonic and bumps by 1 on every release,
# because F-Droid and the Android package manager order installs by it alone. # because F-Droid and the Android package manager order installs by it alone.
versionName = 0.40.0 versionName = 0.41.0
versionCode = 75 versionCode = 76
# Namespace for every platform: cc.tiredsysadmin.<os>.sizzle. Android: # Namespace for every platform: cc.tiredsysadmin.<os>.sizzle. Android:
# cc.tiredsysadmin.android.sizzle (app/), iOS/iPadOS: cc.tiredsysadmin.ios.sizzle # cc.tiredsysadmin.android.sizzle (app/), iOS/iPadOS: cc.tiredsysadmin.ios.sizzle