Skip to content

fix: allow excluding parent folders and their descendants - #504

Merged
estiaksoyeb merged 2 commits into
mpvRex:masterfrom
syamosx:fix/recursive-folder-exclusions
Nov 25, 2026
Merged

estiaksoyeb merged 2 commits into
mpvRex:masterfrom
syamosx:fix/recursive-folder-exclusions

Conversation

@syamosx

@syamosx syamosx commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

A parent folder containing only subfolders is missing from the current exclusion picker. For example, with Movies/REX Demo/Family/Trips/Coast/Preview.mp4, users can find the media-containing leaf but cannot select REX Demo to exclude the whole collection. The flat list also makes it hard to see which folders belong together.

This makes parents selectable even when they contain no direct media, and makes the recursive effect of a selection visible before applying it.

Changes

  • Replace the flat selection dialog with an expandable folder tree. Storage volumes are nonselectable headings.
  • Selecting a parent includes everything below it. A checked square means the whole folder is selected; a numbered badge and “selected inside” label mean only descendants are selected, including when the parent is collapsed. Inherited children are labeled “Included”.
  • Add Browse for folder… as an alternative using Android’s standard folder picker.
  • Apply the same boundary-aware exclusion matching to filesystem paths, external-storage document URIs, cached library reads, folder results, search, and counts. Excluding Family does not exclude Family2.
  • Preserve narrower child selections when a selected parent is unchecked, and count each selected branch once.

Reproduction

  1. Create media under Movies/REX Demo/Family/Trips/Coast/ and Movies/REX Demo/Learning/Photography/, leaving REX Demo itself without media files.
  2. Open Settings → Media & Library → Folders → Choose folders.
  3. Previously, the parent was absent from the flat picker. With this change, expand Movies, then select REX Demo to exclude both branches, or expand it to select individual subfolders.

Screenshots

Screenshots use a small demo folder tree on a physical phone.

Expanded parent folders with distinct partial-selection badges and a selected child branch

Validation

  • ./gradlew assembleDebug testDebugUnitTest passed on this standalone branch (627 tests, zero failures).
  • Expanded and collapsed the demo tree on an Infinix X6886 running Android 16; verified the parent-selection badge remains visible when collapsed, and expanded children show inherited selection.
  • Regression coverage includes parents without direct media, recursive exclusions, sibling path boundaries, document URI normalization, selection restoration, and cached search/counts.

The hidden-folder visibility option is submitted separately in #505.

@estiaksoyeb

Copy link
Copy Markdown
Collaborator

Thanks.

Could you resolve the merge conflicts or Allow edits from maintainers.

@syamosx
syamosx force-pushed the fix/recursive-folder-exclusions branch from 6b8a7de to bac0f2e Compare November 25, 2026 13:18
@syamosx

syamosx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto master to resolve the merge conflict, and enabled "Allow edits from maintainers" as well. Thanks!

@estiaksoyeb
estiaksoyeb merged commit abc72df into mpvRex:master Nov 25, 2026
1 check passed
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.

2 participants