Skip to content

Improve DeckSelectionDialog starting code and remove DeckSpinnerSelection#21075

Open
lukstbit wants to merge 3 commits into
ankidroid:mainfrom
lukstbit:refactor_deckSelectionDialogCodeExtras
Open

Improve DeckSelectionDialog starting code and remove DeckSpinnerSelection#21075
lukstbit wants to merge 3 commits into
ankidroid:mainfrom
lukstbit:refactor_deckSelectionDialogCodeExtras

Conversation

@lukstbit
Copy link
Copy Markdown
Member

Purpose / Description

Consolidates previous code used to fetch the decks presented in DeckSelectionDialog into two single methods for Activities/Fragments. Also removes DeckSpinnerSelection in the process.

Fixes

How Has This Been Tested?

Ran tests, checked the code starting the dialog.

Checklist

  • 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

@github-actions
Copy link
Copy Markdown
Contributor

Snapshot diff report vs main. Open screenshot-diff for diffs.

  • PreferencesScreenshotTest: 1 change
All 1 changed screenshots

PreferencesScreenshotTest

  • AboutFragment_compare.png

@lukstbit
Copy link
Copy Markdown
Member Author

lukstbit commented May 18, 2026

@BrayanDSO AboutFragment date value related screenshot testing failure.

Comment thread AnkiDroid/src/test/java/com/ichi2/anki/pages/StatisticsTest.kt Outdated
@lukstbit lukstbit force-pushed the refactor_deckSelectionDialogCodeExtras branch 3 times, most recently from 74688de to 6ecb1a5 Compare May 19, 2026 08:33
Copy link
Copy Markdown
Contributor

@Giyutomioka-SS Giyutomioka-SS left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@lukstbit lukstbit force-pushed the refactor_deckSelectionDialogCodeExtras branch 2 times, most recently from 1d91557 to 6974613 Compare May 19, 2026 09:43
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, 🥂

Comment on lines +22 to +25
/**
* [DeckId] constant to represent "All decks" in screens that need it(ex. browser).
*/
const val ALL_DECKS_ID = 0L
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The package name is unusual

com.ichi2.anki.utils.ext.ALL_DECKS_ID

Copy link
Copy Markdown
Member Author

@lukstbit lukstbit May 20, 2026

Choose a reason for hiding this comment

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

Didn't think of a better location(didn't look too much into this).
I changed the code to add it to the anki-common module:

  • as we switch to modules this might/probably be used in multiple modules
  • its documentation relies on [DeckId], could remove this reference to place it in the common module

Note: I created a new package: com.ichi2.anki.common.anki in anki-common module.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

lukstbit added 3 commits May 20, 2026 10:48
Consolidates the code that was starting DeckSelectionDialog into just
two methods for Activity/Fragment. The calling sites now don't have to
manually get the decks they want to show.

Note:
DeckPickerWidgetConfig class was filtering the decks shown by
DeckSelectionDialog to remove already selected decks. To simplify the
new implementation this was disabled, but the current code in the
activity handles this scenario.
Will be reimplemented in the future, most likely in DeckSelectionDialog.
Extra step in removing DeckSpinnerSelection
The single method from the file was inlined at the only place it was
used.

Some leftover todos were not really relevant anymore and were removed.
@lukstbit lukstbit force-pushed the refactor_deckSelectionDialogCodeExtras branch from 6974613 to e18e7e2 Compare May 20, 2026 08:06
@lukstbit lukstbit added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review Has Conflicts labels May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants