Changed sort_options array back to user-friendly text (Most Recent, A to Z, etc.)
and added position-based mapping in NotesListFragment to convert between display
labels and internal storage codes.
Added helper methods:
- getSortCodeFromPosition(int): Maps spinner position to internal code
- getPositionFromSortCode(String): Maps internal code back to spinner position
This provides much better UX while maintaining full functionality.
The sort spinner used display strings like 'Most Recent' but the code expected
internal codes like 'MOST_RECENT'. This mismatch caused sorting to always fail.
Changed sort_options array to use exact values expected by NotesStorage.sortNotes():
When deserializing a Note from JSON, the constructor was called first which
initialized original tracking with empty values. Then the JSON fields were
parsed and set, but hasChanges() would always return true because it compared
the loaded content against empty originals.
Solution: Call markAsSaved() after parsing in fromJson() to update the original
tracking with the actual loaded data.
The app was incorrectly updating the note's timestamp every time it was saved,
even when no changes were made. This caused the displayed date to show 'last
opened' instead of 'created/last edited'.
Changes:
- Added hasChanges() method to Note model to detect actual content modifications
- Added markAsSaved() method to update original values after successful save
- Modified saveNoteImmediately() to only update timestamp when changes exist
- Used transient fields for tracking original values (not serialized)
Features:
- Create, edit, and delete notes (text or checklist)
- Sort notes by date or alphabetically
- Dark theme UI with Material Design components
- Checklist items with checkboxes and progress tracking
- Floating action buttons for adding/deleting checklist items
- Auto-save functionality
- Swipe to delete from list
Technical:
- Android Studio project with Gradle build system
- SQLite database via Room-like storage (SharedPreferences)
- RecyclerView for efficient note/item lists
- Fragment-based navigation
Bug Fixes:
- Fixed new notes not appearing in main view after creation
- Added onResume() refresh to NotesListFragment
- Corrected ID assignment and counter logic in NotesStorage