Skip to content

refactor: decouple CardBrowserFragment from CardBrowser activity#21158

Merged
sanjaysargam merged 5 commits into
ankidroid:mainfrom
ShaanNarendran:feat/decouple-card-browser-fragment
May 29, 2026
Merged

refactor: decouple CardBrowserFragment from CardBrowser activity#21158
sanjaysargam merged 5 commits into
ankidroid:mainfrom
ShaanNarendran:feat/decouple-card-browser-fragment

Conversation

@ShaanNarendran
Copy link
Copy Markdown
Contributor

@ShaanNarendran ShaanNarendran commented May 27, 2026

Purpose / Description

Finishes the decoupling for card browser fragment so it can be used outside of card browser activity.

Fixes

  • For GSoC 2026: Redesign Deck Picker

Approach

Moves the remaining dependent parts into the fragment itself:

  • TagsDialogFactory is created during onCreate
  • useSearchView reads from prefs directly
  • selectedDeckNameForUi / searchAllDecks() were moved inline and use viewModel calls
  • addNoteFromCardBrowser registers it's own launcher

How Has This Been Tested?

Compiles and builds successfully.

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

Comment thread AnkiDroid/src/main/java/com/ichi2/anki/browser/CardBrowserFragment.kt Outdated
@ShaanNarendran ShaanNarendran added the GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors label May 27, 2026
david-allison

This comment was marked as resolved.

@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from 05d1964 to ee3bd5b Compare May 27, 2026 20:10
@ShaanNarendran

This comment was marked as resolved.

@david-allison
Copy link
Copy Markdown
Member

Each commit should compile, so the test changes should be done alongside the 'test-breaking' changes to the files

@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from ee3bd5b to 91bc0d8 Compare May 27, 2026 20:30
@criticalAY criticalAY added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels May 27, 2026
@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from 91bc0d8 to 86b5eb8 Compare May 28, 2026 03:56
@ShaanNarendran ShaanNarendran added Needs Review and removed Needs Author Reply Waiting for a reply from the original author labels May 28, 2026
Comment thread AnkiDroid/src/main/java/com/ichi2/anki/browser/CardBrowserFragment.kt Outdated
@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from 86b5eb8 to 4fea281 Compare May 28, 2026 14:13
Comment thread AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Comment thread AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserTest.kt Outdated
@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from 4fea281 to 36cdfbd Compare May 28, 2026 19:53
Copy link
Copy Markdown
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

LGTM, assuming you tested it

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels May 28, 2026
Copy link
Copy Markdown
Member

@sanjaysargam sanjaysargam left a comment

Choose a reason for hiding this comment

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

Great going 🥳

Comment thread AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Comment thread AnkiDroid/src/main/java/com/ichi2/anki/browser/CardBrowserFragment.kt Outdated
@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from 36cdfbd to 66b269f Compare May 29, 2026 05:01
The fragment handles MenuHost itself when useSearchView is on, or casts
the host activity (checked in onAttach).
@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from 66b269f to a8a7871 Compare May 29, 2026 05:10
@ShaanNarendran ShaanNarendran force-pushed the feat/decouple-card-browser-fragment branch from a8a7871 to c90b501 Compare May 29, 2026 14:02
Copy link
Copy Markdown
Member

@sanjaysargam sanjaysargam left a comment

Choose a reason for hiding this comment

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

Good to go. minor nitpick

Comment thread AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserTest.kt
Copy link
Copy Markdown
Member

@sanjaysargam sanjaysargam left a comment

Choose a reason for hiding this comment

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

Here we go. @ShaanNarendran you are rocking

@sanjaysargam sanjaysargam added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels May 29, 2026
@sanjaysargam sanjaysargam enabled auto-merge May 29, 2026 15:21
@sanjaysargam sanjaysargam removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label May 29, 2026
@sanjaysargam sanjaysargam added this pull request to the merge queue May 29, 2026
@david-allison david-allison removed this pull request from the merge queue due to a manual request May 29, 2026
@sanjaysargam sanjaysargam added this pull request to the merge queue May 29, 2026
Merged via the queue into ankidroid:main with commit a30e02e May 29, 2026
20 checks passed
@github-actions github-actions Bot added this to the 2.25 release milestone May 29, 2026
@ShaanNarendran ShaanNarendran deleted the feat/decouple-card-browser-fragment branch May 29, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants