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 <noreply@anthropic.com>
This commit is contained in:
mrambossek
2026-08-01 15:20:57 +02:00
co-authored by Claude Fable 5
parent 172afb421d
commit 305d21f8a7
4 changed files with 9 additions and 3 deletions
@@ -4,6 +4,7 @@
package app.echo_lot.app package app.echo_lot.app
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
@@ -39,7 +40,7 @@ fun HistoryScreen(
onDelete: (String) -> Unit, onDelete: (String) -> Unit,
onBack: () -> 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) { Row(verticalAlignment = Alignment.CenterVertically) {
TextButton(onClick = onBack) { Text(" Back") } TextButton(onClick = onBack) { Text(" Back") }
Text("History", style = MaterialTheme.typography.titleLarge) Text("History", style = MaterialTheme.typography.titleLarge)
@@ -88,7 +88,7 @@ class MainActivity : ComponentActivity() {
when (screen) { when (screen) {
Screen.SETTINGS -> SettingsScreen( Screen.SETTINGS -> SettingsScreen(
settings = vm.settings, settings = vm.settings,
archivedRuns = vm.state.history.size, archivedRuns = vm.archivedRunCount(),
archivedBytes = vm.archivedBytes(), archivedBytes = vm.archivedBytes(),
onApplyRetention = vm::applyRetention, onApplyRetention = vm::applyRetention,
onDeleteAll = vm::deleteAllRuns, onDeleteAll = vm::deleteAllRuns,
@@ -196,6 +196,10 @@ class RunViewModel(app: Application) : AndroidViewModel(app) {
fun archivedBytes(): Long = store.totalBytes() 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. */ /** Redeems an enrollment link, from a paste or from an echolot:// deep link. */
fun enroll(link: String, deviceName: String? = android.os.Build.MODEL) { fun enroll(link: String, deviceName: String? = android.os.Build.MODEL) {
viewModelScope.launch { viewModelScope.launch {
@@ -4,6 +4,7 @@
package app.echo_lot.app package app.echo_lot.app
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
@@ -66,7 +67,7 @@ fun SettingsScreen(
var serverCred by remember { mutableStateOf(settings.serverCredential) } var serverCred by remember { mutableStateOf(settings.serverCredential) }
Column( Column(
Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).padding(16.dp), Modifier.fillMaxWidth().safeDrawingPadding().verticalScroll(rememberScrollState()).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp), verticalArrangement = Arrangement.spacedBy(12.dp),
) { ) {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {