Skip to content

feat: Path picker GUI - #21541

Open
criticalAY wants to merge 5 commits into
ankidroid:mainfrom
criticalAY:path-picker-gui
Open

feat: Path picker GUI#21541
criticalAY wants to merge 5 commits into
ankidroid:mainfrom
criticalAY:path-picker-gui

Conversation

@criticalAY

@criticalAY criticalAY commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Note

Assisted-by: Claude Opus 5

Purpose / Description

Fixes

Approach

See commits, i have broken down the original pr into cleaner commits and few more tests (that doesnt hurt)

How Has This Been Tested?

Everything stays same as original PR:
Screenshot 2026-08-16 at 10 22 47 PM

Learning (optional, can help others)

NA

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Like runCatchingWithReport, but only logs the exception instead of also
sending a crash report. The upcoming directory picker scans storage, where
failures are routine and not worth reporting.

Co-authored-by: ShaanNarendran <shaannaren06@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Important

Maintainers: This PR contains Strings changes

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

@criticalAY criticalAY left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes from original PR still look good to me

@criticalAY criticalAY added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Aug 16, 2026
@criticalAY

Copy link
Copy Markdown
Contributor Author

To address Brayan's comment:

so, how do I remove a path?

By deleting the folder. There is no stored list to remove from: the dialog rescans storage each time it opens, and the only thing saved is the path you currently have selected. So switch to the directory you want first, then delete the old folder and it stops appearing. That covers all three of your cases.

A delete button here would need to handle media, backups and the active collection, so I would rather keep it out of this PR, which replaces a free text field that had no list to remove from either. Happy to open a follow-up issue for it if you want one.

criticalAY and others added 3 commits August 16, 2026 22:38
Checks whether a directory contains a named file, resolving the canonical
path first to guard against path traversal. The upcoming directory picker
uses it to spot existing collections. Comes with a JVM test covering the
edge cases.

Co-authored-by: ShaanNarendran <shaannaren06@gmail.com>

Assisted-by: Claude Opus 5
Scans the storage roots for AnkiDroid directories and lists them for one
tap selection, so an SD card can be chosen without knowing its path. A
neutral button still accepts a custom path, which is normalized, created
and checked for writability before being applied.

Co-authored-by: ShaanNarendran <shaannaren06@gmail.com>
Replaces the free text AnkiDroid directory field in Advanced settings
with the picker.

Fixes ankidroid#3114

Co-authored-by: ShaanNarendran <shaannaren06@gmail.com>
@criticalAY
criticalAY force-pushed the path-picker-gui branch 2 times, most recently from 1b94e7b to fc1dc5d Compare August 16, 2026 17:51
@criticalAY
criticalAY marked this pull request as draft August 16, 2026 18:00
Scaffolding asked for in review: opens the dialog and checks the default
and current directories are offered, and that every entry has a label.

Written as a Robolectric test rather than androidTest: the instrumented
suite runs against the release variant, where the host activity used by
launchFragmentInContainer is missing, as it ships in a debug only manifest.

Co-authored-by: ShaanNarendran <shaannaren06@gmail.com>
@criticalAY
criticalAY marked this pull request as ready for review August 16, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Needs Second Approval Has one approval, one more approval to merge Strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nicer way to enter path to put the collection

1 participant