feat: instant found refresh, silent self-notes, better write flow

Found list updates live (KvPrefs listener + broadcasts) — no rotation needed.

Auto-mark newly created notes as “found” and auto-scroll list to top.

Suppress notification for the just-created note (TTL), keep others unchanged.

Write dialog: BasicTextField plumbing with visible cursor (dark mode), full-area focus, proper placeholders.

Offline w/ image: persist file, queue OutboxWorker, idempotent retries.
This commit is contained in:
2025-09-15 17:44:12 +02:00
parent 7085e42b17
commit 851b03a97f
4 changed files with 121 additions and 29 deletions

View File

@@ -13,12 +13,13 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.lazy.rememberLazyListState // Styr scrollposition
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect // Kör scroll efter recomposition
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.remember // Memo för trigger
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -72,10 +73,18 @@ fun FoundList(
val baseColor = rowTextStyle.color.takeOrElse { Color.LightGray }
val thumbColor = baseColor.copy(alpha = 0.45f)
val listState = rememberLazyListState()
// Trigger: nyaste raden (lager:id:tid) – ändras när nya fynd kommer eller efter rensning
val scrollTrigger = remember(entries) {
entries.firstOrNull()?.let { "${it.layer}:${it.id}:${it.timeMillis}" } ?: "empty"
}
Box(modifier = modifier.fillMaxSize()) {
LaunchedEffect(scrollTrigger) { // Scrolla upp när triggern ändras
listState.scrollToItem(0)
}
Box(modifier = modifier.fillMaxSize()) {
LazyColumn(
state = state,
state = listState,
modifier = Modifier.fillMaxSize()
) {
items(entries, key = { e -> "${e.layer}:${e.id}" }) { e ->