Show password count per folder in the folder list (#79)#167
Open
MiMoHo wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.0for empty folders (simplest, most predictable). Hiding the0is a one-line change if you'd rather.Map<folderId, Int>(groupingBy { }.eachCount()), so it's a single pass regardless of how many folder rows are visible.Changes
ItemList.kt: new pure functionfolderPasswordCounts(passwords);MixedLazyColumnandFolderRowtake an optional count and render it astrailingContent(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
FolderPasswordCountTest) covering per-folder counts, empty folders/lists, and the hidden/trashed exclusion../gradlew testDebugUnitTestis green.Private 9,Work 13), subfolders show their own counts, and openingPrivatelists 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.