Skip to content

Show password count per folder in the folder list (#79)#167

Open
MiMoHo wants to merge 1 commit into
hegocre:mainfrom
MiMoHo:feature/folder-password-count
Open

Show password count per folder in the folder list (#79)#167
MiMoHo wants to merge 1 commit into
hegocre:mainfrom
MiMoHo:feature/folder-password-count

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 5, 2026

Copy link
Copy Markdown

Summary

Implements #79: each folder row in the folder list now shows a trailing number indicating how many passwords it directly contains. You approved this part of the request ("I like the suggestion of showing the number of passwords on a folder"); the URIs-per-item part you were unsure about is intentionally not included.

Behavior / design choices

  • Direct children only. A folder's number is the count of passwords whose folder == folder.id — i.e. exactly the passwords shown when you open that folder. Subfolders are not recursively summed; each subfolder shows its own count. Happy to switch to recursive totals if you'd prefer.
  • Hidden and trashed passwords are excluded, so the number matches the list you see inside the folder.
  • Counts come from the full password list, not the search-filtered one, so the numbers stay correct while a search query is active.
  • Always shown, including 0 for empty folders (simplest, most predictable). Hiding the 0 is a one-line change if you'd rather.
  • Counting is done once per list as a Map<folderId, Int> (groupingBy { }.eachCount()), so it's a single pass regardless of how many folder rows are visible.

Changes

  • ItemList.kt: new pure function folderPasswordCounts(passwords); MixedLazyColumn and FolderRow take an optional count and render it as trailingContent (label style, onSurfaceVariant).
  • NCPNavHost.kt: at the root and nested folder screens, compute the count map (remembered on the decrypted list) and pass it in.

Testing

  • Added JVM unit tests (FolderPasswordCountTest) covering per-folder counts, empty folders/lists, and the hidden/trashed exclusion. ./gradlew testDebugUnitTest is green.
  • Manually verified on an Android 15 emulator against a test server: the root folder list shows correct counts (e.g. Private 9, Work 13), subfolders show their own counts, and opening Private lists exactly 9 direct passwords — matching the number.

Note

This contribution was made using AI (Claude). All generated code was proofread and validated by the committer.

Each folder row now shows a trailing number with how many passwords it
directly contains, as requested in hegocre#79. Counts are computed once per list as
a folderId -> count map from the full decrypted password list, so they stay
accurate while searching. Hidden and trashed passwords are excluded to match
the passwords shown when the folder is opened; counting is direct-children
only (subfolders show their own count).

Adds unit tests for the counting logic.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant