b5bc115f86c6

feat: FAB creates new note when notes filter is active (v2.9.34)

When the notes-only filter is toggled on in the vault list, the + FAB now creates a blank note and navigates straight to the notes editor, instead of opening the generic new-entry form. Content description also switches to 'new note' for accessibility.

time
2026-08-02 01:35 UTC · 2 months ago
machine
koh2
parent
2c2c15b4119d
3 files VERSION+1 −1app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+8 −2app/src/main/java/com/peachpasswords/ui/vault/VaultListViewModel.kt+17 −0
VERSION+1 −1
@@ -1 +1 @@1-2.9.331+2.9.34

view file

app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+8 −2
@@ -313,11 +313,17 @@313313                         Icon(Icons.Outlined.Lock, contentDescription = "Lock vault")314314                     }315315                     FloatingActionButton(316-                        onClick = { onNavigate(PeachNav.EntryEdit(null)) },316+                        onClick = {317+                            if (noteOnly) {318+                                vm.createNote { id -> onNavigate(PeachNav.NotesMode(id)) }319+                            } else {320+                                onNavigate(PeachNav.EntryEdit(null))321+                            }322+                        },317323                         containerColor = LocalPeachAccent.current,318324                         contentColor = peachColors.Bg,319325                     ) {320-                        Icon(Icons.Rounded.Add, contentDescription = "new entry")326+                        Icon(Icons.Rounded.Add, contentDescription = if (noteOnly) "new note" else "new entry")321327                     }322328                 }323329             }

view file

app/src/main/java/com/peachpasswords/ui/vault/VaultListViewModel.kt+17 −0
@@ -88,6 +88,23 @@8888         proNoticeStore.dismiss()8989     }9090 91+    /** Create a blank note and invoke [onOpen] with its id for navigation. */92+    fun createNote(onOpen: (String) -> Unit) {93+        viewModelScope.launch {94+            val created = vault.addEntry(95+                VaultEntry(96+                    id = "",97+                    type = "note",98+                    title = "Untitled",99+                    notes = null,100+                    createdAt = 0L,101+                    modifiedAt = 0L,102+                ),103+            )104+            onOpen(created.id)105+        }106+    }107+91108     // ── Multi-select ────────────────────────────────────────────────────────92109     private val _isMultiSelectMode = MutableStateFlow(false)93110     val isMultiSelectMode: StateFlow<Boolean> = _isMultiSelectMode.asStateFlow()

view file