Skip to content

Fix/minor fixes#890

Merged
Crustack merged 4 commits intomainfrom
fix/minor-fixes
Mar 5, 2026
Merged

Fix/minor fixes#890
Crustack merged 4 commits intomainfrom
fix/minor-fixes

Conversation

@Crustack
Copy link
Owner

@Crustack Crustack commented Mar 5, 2026

Summary by CodeRabbit

  • New Features

    • Delete now offers an undo via a Snackbar so removed notes can be restored immediately.
  • Bug Fixes

    • Improved reliability and safety of top/bottom action customization and long-press reconfiguration, preventing out-of-bounds/edit issues.
  • Style

    • Icons updated with consistent tinting for improved visual consistency.
  • Chores

    • Updated changelog tooling to exclude out-of-scope labels.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ad42abae-dd8a-4820-8f98-b2f5f7f12970

📥 Commits

Reviewing files that changed from the base of the PR and between 2701929 and d3993f1.

📒 Files selected for processing (7)
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/viewmodel/BaseNoteModel.kt
  • app/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.kt
  • app/src/main/res/drawable/edit.xml
  • app/src/main/res/drawable/home.xml
  • generate-changelogs.sh

📝 Walkthrough

Walkthrough

Adds undo-capable permanent deletion in MainActivity using a Snackbar that calls a new BaseNoteModel.saveNotes; refactors EditActivity to use index-based action selection; removes itemId from EditAction; adds tint to two vector drawables; updates changelog exclude labels.

Changes

Cohort / File(s) Summary
Undo Deletion Flow
app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt, app/src/main/java/com/philkes/notallyx/presentation/viewmodel/BaseNoteModel.kt
Delete-forever now captures selected notes, performs deletion, and shows a Snackbar offering "Undo" which calls newly added saveNotes(List<BaseNote>) to re-insert removed notes.
Action Selection Refactor
app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt, app/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.kt
showActionSelectionDialog() gained an index param; top/bottom action handling and long-clicks now use explicit indices; EditAction enum removed the itemId constructor parameter and entries were updated.
Drawable Tinting
app/src/main/res/drawable/edit.xml, app/src/main/res/drawable/home.xml
Added android:tint="?attr/colorControlNormal" to vector drawables to enable theme tinting.
Changelog Script
generate-changelogs.sh
Added out of scope to the --exclude-labels list used by the changelog generator.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MainActivity
    participant BaseNoteModel
    participant DAO
    participant Snackbar

    User->>MainActivity: Confirm "Delete Forever"
    MainActivity->>MainActivity: Capture selected notes (removedNotes)
    MainActivity->>BaseNoteModel: deleteSelectedBaseNotes()
    BaseNoteModel->>DAO: Delete notes
    MainActivity->>Snackbar: Show snackbar with "Undo"
    User->>Snackbar: Tap "Undo"
    Snackbar->>BaseNoteModel: saveNotes(removedNotes)
    BaseNoteModel->>DAO: Insert notes back
    DAO-->>MainActivity: Notes restored
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

Poem

🐰 I nudged the trash and saved a tune,
Notes hopped back beneath the moon.
Indexes aligned, icons now bright,
Undo returned them in soft moonlight.
✨🫧

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
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.
Title check ❓ Inconclusive The title "Fix/minor fixes" is vague and generic, using non-descriptive language that fails to convey the specific changes made across multiple files including undo functionality, action refactoring, and drawable tinting. Use a more specific title that highlights the main change, such as "Add undo support to delete-forever action" or "Refactor action selection and UI improvements". Avoid generic terms like "minor fixes".
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 fix/minor-fixes

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

🤖 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/activity/main/MainActivity.kt`:
- Around line 427-437: The quantity string is using a hardcoded 1; change it to
use the actual deleted count by passing the size of the selected notes to
getQuantityString. In the positive button handler (around
baseModel.actionMode.selectedNotes and baseModel.deleteSelectedBaseNotes()),
determine the count from removedNotes.size (or
baseModel.actionMode.selectedNotes.size) and pass that count into
getQuantityString(R.plurals.deleted_selected_notes, count) so the Snackbar shows
the correct pluralized message; keep using removedNotes for undo via
baseModel.saveNotes(removedNotes).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9b7ba9e-3cfb-4035-be8a-a5f19c9474e1

📥 Commits

Reviewing files that changed from the base of the PR and between 9b7bbc1 and 5349238.

📒 Files selected for processing (7)
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/viewmodel/BaseNoteModel.kt
  • app/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.kt
  • app/src/main/res/drawable/edit.xml
  • app/src/main/res/drawable/home.xml
  • generate-changelogs.sh

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.

🧹 Nitpick comments (1)
app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt (1)

337-341: Add strict index bounds guards before updating top-action lists.

The new index-based flow is good, but both callback write paths should verify index in currentActions.indices before assignment to avoid edge-case IndexOutOfBoundsException.

Suggested defensive fix
-                        val currentActions = prefs.editNoteActivityTopActions.value.toMutableList()
-                        if (
-                            index != -1 &&
-                                index < NotallyXPreferences.DEFAULT_EDIT_NOTE_TOP_ACTIONS.size
-                        ) {
+                        val currentActions =
+                            prefs.getSafeEditNoteActivityTopActions().toMutableList()
+                        if (
+                            index in currentActions.indices &&
+                                index < NotallyXPreferences.DEFAULT_EDIT_NOTE_TOP_ACTIONS.size
+                        ) {
                             currentActions[index] =
                                 NotallyXPreferences.DEFAULT_EDIT_NOTE_TOP_ACTIONS[index]
                             prefs.editNoteActivityTopActions.save(currentActions)
                         }
@@
-                    if (index != -1) {
+                    if (index in currentActions.indices) {
                         currentActions[index] = newAction
                         prefs.editNoteActivityTopActions.save(currentActions)
                     }
🤖 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/note/EditActivity.kt`
around lines 337 - 341, In showActionSelectionDialog, add strict bounds checks
before writing to the action lists: before assigning into currentActions[index]
(and the alternate callback write path that updates the top-action list), verify
index in currentActions.indices (and index in topActions.indices when updating
topActions) and bail out or clamp if not; update both callback branches that
perform index-based assignments to guard with these checks to prevent
IndexOutOfBoundsException.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt`:
- Around line 337-341: In showActionSelectionDialog, add strict bounds checks
before writing to the action lists: before assigning into currentActions[index]
(and the alternate callback write path that updates the top-action list), verify
index in currentActions.indices (and index in topActions.indices when updating
topActions) and bail out or clamp if not; update both callback branches that
perform index-based assignments to guard with these checks to prevent
IndexOutOfBoundsException.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 882a7cd5-c72b-405e-8970-45b9e4efaeb1

📥 Commits

Reviewing files that changed from the base of the PR and between 5349238 and 2701929.

📒 Files selected for processing (7)
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt
  • app/src/main/java/com/philkes/notallyx/presentation/viewmodel/BaseNoteModel.kt
  • app/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.kt
  • app/src/main/res/drawable/edit.xml
  • app/src/main/res/drawable/home.xml
  • generate-changelogs.sh
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt
  • app/src/main/res/drawable/home.xml
  • app/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.kt
  • app/src/main/res/drawable/edit.xml

@Crustack Crustack merged commit 071ef8f into main Mar 5, 2026
@Crustack Crustack deleted the fix/minor-fixes branch March 5, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant