Skip to content

feat: toggleable incrementer for "Learn ahead limit" and "Timebox time limit"#21336

Open
Yousuf24100286 wants to merge 4 commits into
ankidroid:mainfrom
Yousuf24100286:feat/20478-toggleable-learn-timebox-dialog
Open

feat: toggleable incrementer for "Learn ahead limit" and "Timebox time limit"#21336
Yousuf24100286 wants to merge 4 commits into
ankidroid:mainfrom
Yousuf24100286:feat/20478-toggleable-learn-timebox-dialog

Conversation

@Yousuf24100286

@Yousuf24100286 Yousuf24100286 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Purpose / Description

The "Learn ahead limit" and "Timebox time limit" required user to manually enter 0 to disable the feature.
Now added a toggle switch to enable/disable the limit.

Fixes

Approach

  • new preference class ToggleableIncrementerNumberRangePreferenceCompat
    • extends NumberRangePreferenceCompat
    • contains a MaterialSwitch toggle in the dialog
  • Logic:
    • when toggle is off, incrementer is hidden and value is 0
    • when toggle is on, incrementer is shown and value is default to 1
    • 0 = disabled logic is preserved

How Has This Been Tested?

  • unit tests for logic validation
  • assemblePlayDebug builds successfully, lintPlayDebug passes
  • all existing tests passes
  • manually tested on physical device
    • build and open app
    • setting -> reviewing
    • then check for time limit box and learn ahead limit

Screenshots

Toggle Switch OFF Toggle Switch ON
Screenshot_20260706-011649 Screenshot_20260706-011646

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

@welcome

welcome Bot commented Jul 3, 2026

Copy link
Copy Markdown

First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible.

@github-actions

github-actions Bot commented Jul 3, 2026

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

@ZornHadNoChoice

Copy link
Copy Markdown
Collaborator

Sorry, but, umm... you made the same mistake as the previous assignee despite there being clear instructions on how it should look like.

@github-actions github-actions Bot removed the Strings label Jul 4, 2026
@Yousuf24100286

Copy link
Copy Markdown
Contributor Author
Toggle Switch OFF Toggle Switch ON
Screenshot_20260704-115833 Screenshot_20260704-115837

@ZornHadNoChoice pls review. is this how I was supposed to do it ?

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

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

  • PreferencesScreenshotTest: 1 change
All 1 changed screenshots

PreferencesScreenshotTest

  • ReviewingSettingsFragment_compare.png

@ZornHadNoChoice

Copy link
Copy Markdown
Collaborator

Almost. There should be a vertical bar like in the "Sync URL" toggle.

@Yousuf24100286

Copy link
Copy Markdown
Contributor Author
Toggle Switch OFF Toggle Switch ON
Screenshot_20260706-011649 Screenshot_20260706-011646

@ZornHadNoChoice pls review.

@ZornHadNoChoice

Copy link
Copy Markdown
Collaborator

It looks good, but I have no idea about the functionality or the code. I'm not a dev.

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 "Learn ahead limit" and "Timebox time limit" dialogs

2 participants