From 305d21f8a7be99418df7e108f6d4f19007b8cfea Mon Sep 17 00:00:00 2001 From: mrambossek Date: Sat, 1 Aug 2026 15:20:57 +0200 Subject: [PATCH] app: insets on the two newer screens, and one source for the run count On-device verification found both. safeDrawingPadding() was on the run screen but not on Settings or History - they were added later and never got it - so "< Back Settings" sat under the status-bar clock. The same fault the run screen had already fixed, reintroduced by new code that did not know about it. Settings also read "0 run(s), 23 kB stored": the count came from UiState.history, which stays empty until the History screen has been opened, while the size read the archive directly. Two sources for one fact; the count now reads the archive too. Verified on a OnePlus 15 (A16): header clears the status bar, count reads "1 run(s), 23 kB stored". Co-Authored-By: Claude Fable 5 --- .../app/src/main/kotlin/app/echo_lot/app/HistoryScreen.kt | 3 ++- .../app/src/main/kotlin/app/echo_lot/app/MainActivity.kt | 2 +- .../app/src/main/kotlin/app/echo_lot/app/RunViewModel.kt | 4 ++++ .../app/src/main/kotlin/app/echo_lot/app/SettingsScreen.kt | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/echolot-app/app/src/main/kotlin/app/echo_lot/app/HistoryScreen.kt b/echolot-app/app/src/main/kotlin/app/echo_lot/app/HistoryScreen.kt index bc0fc8a..96de162 100644 --- a/echolot-app/app/src/main/kotlin/app/echo_lot/app/HistoryScreen.kt +++ b/echolot-app/app/src/main/kotlin/app/echo_lot/app/HistoryScreen.kt @@ -4,6 +4,7 @@ package app.echo_lot.app import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -39,7 +40,7 @@ fun HistoryScreen( onDelete: (String) -> Unit, onBack: () -> Unit, ) { - Column(Modifier.fillMaxWidth().padding(16.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { + Column(Modifier.fillMaxWidth().safeDrawingPadding().padding(16.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { Row(verticalAlignment = Alignment.CenterVertically) { TextButton(onClick = onBack) { Text("‹ Back") } Text("History", style = MaterialTheme.typography.titleLarge) diff --git a/echolot-app/app/src/main/kotlin/app/echo_lot/app/MainActivity.kt b/echolot-app/app/src/main/kotlin/app/echo_lot/app/MainActivity.kt index 56c3b50..763b19f 100644 --- a/echolot-app/app/src/main/kotlin/app/echo_lot/app/MainActivity.kt +++ b/echolot-app/app/src/main/kotlin/app/echo_lot/app/MainActivity.kt @@ -88,7 +88,7 @@ class MainActivity : ComponentActivity() { when (screen) { Screen.SETTINGS -> SettingsScreen( settings = vm.settings, - archivedRuns = vm.state.history.size, + archivedRuns = vm.archivedRunCount(), archivedBytes = vm.archivedBytes(), onApplyRetention = vm::applyRetention, onDeleteAll = vm::deleteAllRuns, diff --git a/echolot-app/app/src/main/kotlin/app/echo_lot/app/RunViewModel.kt b/echolot-app/app/src/main/kotlin/app/echo_lot/app/RunViewModel.kt index 94292f1..583c8b7 100644 --- a/echolot-app/app/src/main/kotlin/app/echo_lot/app/RunViewModel.kt +++ b/echolot-app/app/src/main/kotlin/app/echo_lot/app/RunViewModel.kt @@ -196,6 +196,10 @@ class RunViewModel(app: Application) : AndroidViewModel(app) { fun archivedBytes(): Long = store.totalBytes() + /** Counted from the archive itself, not from [UiState.history], which is empty until the + * history screen has been opened - the two disagreeing read as data loss. */ + fun archivedRunCount(): Int = store.list().size + /** Redeems an enrollment link, from a paste or from an echolot:// deep link. */ fun enroll(link: String, deviceName: String? = android.os.Build.MODEL) { viewModelScope.launch { diff --git a/echolot-app/app/src/main/kotlin/app/echo_lot/app/SettingsScreen.kt b/echolot-app/app/src/main/kotlin/app/echo_lot/app/SettingsScreen.kt index d6f03c2..5d59bac 100644 --- a/echolot-app/app/src/main/kotlin/app/echo_lot/app/SettingsScreen.kt +++ b/echolot-app/app/src/main/kotlin/app/echo_lot/app/SettingsScreen.kt @@ -4,6 +4,7 @@ package app.echo_lot.app import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -66,7 +67,7 @@ fun SettingsScreen( var serverCred by remember { mutableStateOf(settings.serverCredential) } Column( - Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).padding(16.dp), + Modifier.fillMaxWidth().safeDrawingPadding().verticalScroll(rememberScrollState()).padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp), ) { Row(verticalAlignment = Alignment.CenterVertically) {