Skip to content

Conversation

@david-allison
Copy link
Member

@david-allison david-allison commented Jan 27, 2026


Purpose / Description

We define and use SortOrderBottomSheetFragment, a bottom sheet fragment which supports:

  • All sortable Anki Columns
  • 'No sorting' (AnkiDroid specific)
  • Display of disabled columns (FSRS columns, if not enabled, 'question' and 'answer' in cards mode)

The order of columns is:

  • No Sorting
  • Columns available in the UI
  • Remaining columns, which are not disabled, in AnkiDroid's default column order
  • Disabled columns which are NOT in the UI

This replaces the previous implementation

Fixes

Approach

Define a standard bottom sheet fragment: SortOrderBottomSheetFragment with newInstance() to initialize args from the collection

Define an adapter, which does most of the heavy lifting

⚠️ This was borderline using itemViewType for the logic - didn't feel worthwhile

How Has This Been Tested?

Extensive unit tests

Screenshot 2026-01-30 at 15 22 40

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

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 27, 2026
@github-actions
Copy link
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

david-allison and others added 10 commits January 30, 2026 13:03
* Add `CheckResult`
* make `internal`
* Remove SortOrderUtil`
* replace `else` with concrete type
* Add tests
* Renamed original implementations:
  * findCards => findCardsLegacy
  * findNotes => findNotesLegacy
  * BuiltinSortKind => LegacyBuiltinSortKind
* Adds:
  * BuiltinColumnSortKind
  * collection.buildSortMode
* updates `FinderTest` and `SortOrderTest`

All but one method was updated to the non-legacy
 implementation due to:

* only `query` was set
* a valid `SortOrder` was provided (typically `NoOrdering`)
* test-only method

https://github.com/ankitects/anki/blob/6247c92dcce0204f0e666b9e9e5355d2a15649d6/pylib/anki/collection.py#L634-L712
* findCardsLegacy
* findNotesLegacy

Only `CardBrowser.searchForRows` used the order parameter

I have confirmed that the implementations are the same
The `CardId` parameter is marked as missing, removing it
 breaks compilation
Co-authored-by: ShaanNarendran <shaannaren06@gmail.com>
* Move 'SortType' to 'LegacySortType'
* Define and test the new 'SortType'

Prep for issue 17732
@david-allison david-allison added Blocked by dependency Currently blocked by some other dependent / related change and removed Needs Author Reply Waiting for a reply from the original author labels Jan 30, 2026
*
* 'Question' is unavailable in Cards mode
*/
val available: Boolean
Copy link
Member Author

Choose a reason for hiding this comment

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

Rename to canBeSorted

@david-allison
Copy link
Member Author

david-allison commented Feb 1, 2026

Use the colors/style in bc78d4a for the buttons. Much better than my attempt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked by dependency Currently blocked by some other dependent / related change Strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card Browser: Convert Display Order to Chip for sorting

1 participant