Skip to content

Fix improve the review ahead refactor#20678

Open
Galal-20 wants to merge 11 commits intoankidroid:mainfrom
Galal-20:fix-Improve-the-Review-ahead-refactor
Open

Fix improve the review ahead refactor#20678
Galal-20 wants to merge 11 commits intoankidroid:mainfrom
Galal-20:fix-Improve-the-Review-ahead-refactor

Conversation

@Galal-20
Copy link
Copy Markdown
Contributor

@Galal-20 Galal-20 commented Apr 7, 2026

Purpose / Description

This PR improves the Review Ahead dialog UX to align with expected behavior and consistency
Additionally, the query construction has been refactored and clarified based on Anki's search syntax (deck + prop:due), which is used across Anki Desktop and backend.

Fixes

Fixes: #20600

Approach

The following improvements were implemented:

UI Enhancements:

Added dialog title: “Review ahead”
Updated description to: “Review cards due in the next:”
Replaced positive button text from “OK” → “Create”
Added dynamic unit suffix “day”/“days” 

Input Validation Improvements:

Prevented leading zeros 
Limited input length 
Added real-time validation
Disabled the action button when:
input is invalid
input is zero
no matching cards are found

ْUnit Tests:

Added unit tests to validate query construction logic:

- Ensured correct query format for "Review Ahead":
    deck:"<deckName>" prop:due<=<daysAhead>

- Ensured fallback behavior for other options:
    returns only deck:"<deckName>"

- Tests cover edge cases and confirm consistency with Anki search syntax

How Has This Been Tested?

Tested manually on:
Android Emulator (API 33) and Physical device

Test Cases:

1.	Open “Review Ahead” dialog → verify:
              Title is displayed
              Description is correct
              Default value shows correct suffix (“days”)

4.	Input validation:
              Enter non-numeric → error shown, button disabled
              Enter 0 → error shown, button disabled
              Enter valid number → suffix updates correctly (day/days)

5.	Edge cases:
              Enter large number → input limited correctly
              Leading zero is prevented

6.	Empty result case:
             Enter value with no matching cards → inline error shown
             Button disabled (no dialog appears)

Screenshots

some screens:
1
2
3
4

Reference:
https://docs.ankiweb.net/searching.html

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title.
  • 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]

Galal-20 added 11 commits March 28, 2026 08:32
- Add a title "Review ahead".
- Change the description with "Review cards due in the next:".
- Added a unit "day"/"days" to the box.
- Change "OK" with "Create".
- Show a warning when the input is invalid, limit the digits, and prevent leading zeros.
…"1") while still preventing leading zeros in other cases.

fix: Code Enhancement
 - Improve the comments by add a comment for documentation and remove unnecessary comments.
 - Update limit prevent excessively long numeric input.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

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

@Galal-20
Copy link
Copy Markdown
Contributor Author

Galal-20 commented Apr 7, 2026

Hello @david-allison,
Thanks for taking a look at this PR
I’ve refactored the “Review Ahead” dialog UX and query construction for clarity and consistency.
All edge cases are covered with unit tests.
Happy to adjust anything based on your feedback.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the Review ahead dialog

1 participant