Skip to content

Only display non deleted/archived notes and correctly sort reminders view#925

Merged
Crustack merged 4 commits intomainfrom
feat/913
Mar 16, 2026
Merged

Only display non deleted/archived notes and correctly sort reminders view#925
Crustack merged 4 commits intomainfrom
feat/913

Conversation

@Crustack
Copy link
Owner

@Crustack Crustack commented Mar 15, 2026

Closes #913

  • By default Upcoming Filter is set in Reminders View
  • Reordered Filters to Upcoming, Elapsed, All
  • For Upcoming: Sorted by the next notification (ascending)
  • For Elapsed: Sorted by last notification (descending)
  • For All: Sorted by next notification (descending) for upcoming reminders, and by last notification (descending) for elapsed reminders

Summary by CodeRabbit

  • New Features

    • Added multiple reminder sort options: next, last, and most‑recent notification ordering.
    • Adapter-aware sorting via per-adapter sort callbacks so list ordering adapts to active filter and preferences.
  • Bug Fixes

    • Notes query now restricts results to the NOTES folder, reducing unexpected items.
  • UI

    • Reminder filter chips reordered so Upcoming is the default selection.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a2dd9a9-ff80-499a-83fd-963f4164958d

📥 Commits

Reviewing files that changed from the base of the PR and between cd7b01c and a75ed1e.

📒 Files selected for processing (10)
  • app/src/main/java/com/philkes/notallyx/data/dao/BaseNoteDao.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/NotallyFragment.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/RemindersFragment.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/note/PickNoteActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteAdapter.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteVH.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/sorting/BaseNoteLastNotificationSort.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/sorting/BaseNoteMostRecentNotificationSort.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/sorting/BaseNoteNextNotificationSort.kt
  • app/src/main/res/layout/fragment_notes.xml
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/java/com/philkes/notallyx/data/dao/BaseNoteDao.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteVH.kt

📝 Walkthrough

Walkthrough

Replace per-adapter sort with callbacks, add three notification-aware ItemSorts and comparison helpers, expose view-holder sort preference, change reminders default to UPCOMING (chip swap), and restrict DAO reminders query to folder = 'NOTES'.

Changes

Cohort / File(s) Summary
DAO
app/src/main/java/com/philkes/notallyx/data/dao/BaseNoteDao.kt
getAllBaseNotesWithReminders SQL now filters AND folder = 'NOTES', narrowing results to notes in the NOTES folder.
Adapter API & wiring
app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteAdapter.kt, app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/NotallyFragment.kt, app/src/main/java/com/philkes/notallyx/presentation/activity/note/PickNoteActivity.kt
Replace direct NotesSort with notesSortCallback: (BaseNoteAdapter) -> SortedListAdapterCallback<Item>; add setNotesSortCallback; call sites switched to provide callbacks via createCallback(adapter).
ViewHolder prefs
app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteVH.kt
BaseNoteVHPreferences adds sortedBy: NotesSortBy; bind uses preferences.sortedBy.
Notification-based sorting
app/src/main/java/com/philkes/notallyx/presentation/view/main/sorting/BaseNoteNextNotificationSort.kt, .../BaseNoteLastNotificationSort.kt, .../BaseNoteMostRecentNotificationSort.kt
Add three ItemSort classes and extension compare helpers (compareNextNotification, compareLastNotification) to sort by next/last/most-recent notification with null-aware logic and SortDirection.
Reminders UI & behavior
app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/RemindersFragment.kt, app/src/main/res/layout/fragment_notes.xml
Default reminder filter set to UPCOMING (chip IDs/text swapped in layout); RemindersFragment overrides notesAdapterSortCallback to select notification-aware sorts per filter and resets adapter sort after filtering.

Sequence Diagram(s)

sequenceDiagram
    participant Fragment as RemindersFragment / NotallyFragment
    participant Adapter as BaseNoteAdapter
    participant SortImpl as ItemSort (NEXT / LAST / MOST_RECENT)
    participant SortedList as SortedList

    Fragment->>Adapter: setNotesSortCallback(callbackForFilter)
    Fragment->>Adapter: set data / applyFilter()
    Adapter->>Adapter: notesSortCallback(this)    rgba(100,150,240,0.5)
    Adapter->>SortImpl: instantiate sort (adapter, direction)
    Adapter->>SortedList: replaceAll / resync using SortImpl comparator
    SortedList-->>Adapter: ordered items
    Adapter-->>Fragment: bound views reflect sorted order
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇
I hop through callbacks, tidy and fleet,
Reminders lined up, next ones to meet.
UPCOMING first, I nudge them in place,
Sorts and chips dancing, a neat little race.
Carrot cheers for every sorted chase!

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses display filtering (#913) but does not implement the core feature: auto-removal of elapsed reminders after a configurable period. Implement the auto-removal logic for elapsed reminders with a configurable time period setting, or clarify if this PR is a partial implementation addressing only the display layer.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: filtering non-deleted/archived notes and fixing reminders view sorting behavior.
Out of Scope Changes check ✅ Passed Changes introduce new sorting classes and refactor adapter callback mechanisms, which are reasonable to support the reminders view requirements, though somewhat tangential to the core auto-removal feature.
Description check ✅ Passed The PR description clearly documents the filtering changes and sorting behavior for the reminders view across different filter states.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/913
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/NotallyFragment.kt (1)

313-315: ⚠️ Potential issue | 🔴 Critical

Preference changes silently override fragment-specific sort behavior.

When a user changes the sort preference (lines 313-315), setNotesSort() unconditionally replaces the adapter's sort callback via setNotesSortCallback(), overwriting any custom callback provided by subclasses like RemindersFragment. While RemindersFragment can restore its filter-aware sorting via applyFilter() and setNotesSortCallback(), this only occurs on explicit filter UI interaction—if the user changes the preference without using the filter, the custom sort is silently lost until they next interact with the filter controls.

To prevent regression, either:

  1. Expose a way to check if a custom callback is active, and skip the preference update in that case
  2. Have subclasses re-establish their callbacks after a preference change
  3. Introduce a priority system (e.g., prefer fragment-specific callbacks over preference-driven ones)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/NotallyFragment.kt`
around lines 313 - 315, The observer on model.preferences.notesSorting should
not unconditionally overwrite fragment-specific sorting callbacks; change the
logic in the notesSorting observer (the block that calls
notesAdapter?.setNotesSort(notesSort)) to first check whether the adapter
currently has a fragment-provided/custom sort callback (e.g., add and use a new
NotesAdapter method hasCustomSortCallback() or isUsingFragmentCallback()), and
only call setNotesSort(notesSort) when no custom callback is active;
alternatively, after applying the preference change invoke a fragment hook
(e.g., RemindersFragment.applyFilter() or a new restoreFragmentSortCallback()
method) so subclasses can re-establish their filter-aware callback via
setNotesSortCallback().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteAdapter.kt`:
- Around line 167-173: The mapping in NotesSort.createCallback incorrectly
assigns NotesSortBy.MODIFIED_DATE to BaseNoteNextNotificationSort (sorting by
reminder) instead of the intended BaseNoteModifiedDateSort; update the when
branch for NotesSortBy.MODIFIED_DATE to construct and return
BaseNoteModifiedDateSort(adapter, sortDirection) so modification-date sorting
uses the correct comparator while keeping the adapter and sortDirection
parameters intact.

---

Outside diff comments:
In
`@app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/NotallyFragment.kt`:
- Around line 313-315: The observer on model.preferences.notesSorting should not
unconditionally overwrite fragment-specific sorting callbacks; change the logic
in the notesSorting observer (the block that calls
notesAdapter?.setNotesSort(notesSort)) to first check whether the adapter
currently has a fragment-provided/custom sort callback (e.g., add and use a new
NotesAdapter method hasCustomSortCallback() or isUsingFragmentCallback()), and
only call setNotesSort(notesSort) when no custom callback is active;
alternatively, after applying the preference change invoke a fragment hook
(e.g., RemindersFragment.applyFilter() or a new restoreFragmentSortCallback()
method) so subclasses can re-establish their filter-aware callback via
setNotesSortCallback().

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 594e3058-1f78-4b37-98f4-2600660f3b94

📥 Commits

Reviewing files that changed from the base of the PR and between f734488 and e5fadbd.

📒 Files selected for processing (10)
  • app/src/main/java/com/philkes/notallyx/data/dao/BaseNoteDao.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/NotallyFragment.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/fragment/RemindersFragment.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/note/PickNoteActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteAdapter.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/BaseNoteVH.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/sorting/BaseNoteLastNotificationSort.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/sorting/BaseNoteMostRecentNotificationSort.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/main/sorting/BaseNoteNextNotificationSort.kt
  • app/src/main/res/layout/fragment_notes.xml

@Crustack Crustack merged commit 6b3e2b4 into main Mar 16, 2026
2 checks passed
@Crustack Crustack deleted the feat/913 branch March 16, 2026 17:36
@Crustack Crustack added enhancement New feature or request v7.10.0 labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request v7.10.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto remove elapsed reminders after

1 participant