feat(reminders): review reminders RecyclerView#18964
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds RecyclerView functionality to the ScheduleReminders fragment, enabling users to view, toggle, and interact with review reminders. The implementation includes adapter creation, database integration, and UI setup for reminder management.
- Added RecyclerView with ScheduleRemindersAdapter to display review reminders in a list format
- Implemented reminder state management including enable/disable toggling and database persistence
- Added deck name caching and display logic with support for both global and deck-specific reminders
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ScheduleRemindersAdapter.kt | New adapter class for RecyclerView displaying reminder items with toggle functionality |
| ScheduleReminders.kt | Enhanced fragment with RecyclerView setup, database integration, and reminder management logic |
AnkiDroid/src/main/java/com/ichi2/anki/reviewreminders/ScheduleRemindersAdapter.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/reviewreminders/ScheduleRemindersAdapter.kt
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/reviewreminders/ScheduleReminders.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/reviewreminders/ScheduleReminders.kt
Show resolved
Hide resolved
|
Ready for review! Please also look through the above comments from Copilot if you have time. Thanks. |
criticalAY
left a comment
There was a problem hiding this comment.
Small change rest is good
| import com.google.android.material.materialswitch.MaterialSwitch | ||
| import com.ichi2.anki.R | ||
|
|
||
| class ScheduleRemindersAdapter( |
There was a problem hiding this comment.
You can use Diff callback here
There was a problem hiding this comment.
Oh, I didn't know about this feature! Thanks for pointing it out, it streamlines a lot of my code. Implemented.
Arthur-Milchior
left a comment
There was a problem hiding this comment.
LGTM once @criticalAY request is considered
517c202 to
24397fe
Compare
|
|
Minor edit!
|
GSoC 2025: Review Reminders - Added RecyclerView to ScheduleReminders fragment. - Created ScheduleRemindersAdapter, which holds the state of each individual row in the RecyclerView. The adapter has functionality in the form of functions passed to it via its constructor to keep most of the key functionality centralized within ScheduleReminders and to avoid injecting a Context into the adapter, which should optimally be context-free. I tried to keep the adapter as short as possible; it only governs the UI of each individual reminder in the RecyclerView. - Added `setDeckNameFromScopeView` method, which retrieves deck names from the collection for displaying in the UI. Deck names are cached to prevent repeated calls to the collection. - Added empty placeholder methods for adding reminders and editing reminders that will be filled in by a future PR. - Added logic for toggling whether reminders are enabled and saving that state. - Put a RecyclerView `reminders` content state controlling data structure into ScheduleReminders. Made it a HashMap for cleaner access operations without element-by-element search for deletion, etc. - Added `onDeckSelected`, a method that will allow the code to detect if the AddEditReminderDialog (coming soon) has had the deck selected in the deck selection dialog changed. We must catch this in ScheduleReminders because this onChange event has to be caught by a Fragment, whereas the AddEditReminderDialog is just a dialog that gets briefly removed when the deck selection dialog appears. The data is forwarded to the AddEditReminderDialog via a FragmentResult, a very simple way of passing information between fragments. - Added constants that will be used for pushing information to and from the AddEditReminderDialog to the ScheduleReminders companion object. - Fixed a small Timber call to use format arguments rather than interpolation. - Created a `triggerUIUpdates` method for ease of posting the reminders to the adapter.
GSoC 2025: Review Reminders - Added a `catchDatabaseExceptions` wrapper method to ScheduleReminders. By wrapping calls to the database with this function, any database errors caught fail gracefully and show an error dialog to the user. If the database access takes too long, a progress bar shows up, too. - Previously, this was a method that also included schema migration logic etc., but that's now been moved to ankidroid#18856, so it's now possible for me to move this small snippet here instead.
195315b to
025bf39
Compare
|
Minor edit!
|
GSoC 2025: Review Reminders - Quick commit making toggleReminderEnabled a little more clear and readable, removing unnecessary null handling.
025bf39 to
e153676
Compare
|
One test failed for some reason only on Windows, it looks like it's CI breaking and not my code. Rerunning tests. |
|
Ready for review! |
Purpose / Description
setDeckNameFromScopeViewmethod, which retrieves deck names from the collection for displaying in the UI. Deck names are cached to prevent repeated calls to the collection.reminderscontent state controlling data structure into ScheduleReminders. Made it a HashMap for cleaner access operations without element-by-element search for deletion, etc.onDeckSelected, a method that will allow the code to detect if the AddEditReminderDialog (coming soon) has had the deck selected in the deck selection dialog changed. We must catch this in ScheduleReminders because this onChange event has to be caught by a Fragment, whereas the AddEditReminderDialog is just a dialog that gets briefly removed when the deck selection dialog appears. The data is forwarded to the AddEditReminderDialog via a FragmentResult, a very simple way of passing information between fragments.triggerUIUpdatesmethod for ease of posting the reminders to the adapter.Fixes
Approach
How Has This Been Tested?
Checklist