feat: remember preview/edit mode per note#3203
Open
jancborchardt wants to merge 1 commit into
Open
Conversation
Adds a `noteMode` column to the Note table (DB version 29 → 30) to persist each note's view mode independently. When a user explicitly toggles Preview/Edit/DirectEdit, the new mode is saved immediately to the note, overriding the global SharedPreferences setting for that specific note. Notes without a stored per-note mode continue to follow the global preference as before. Resolves the TODO comment in EditNoteActivity.close(). AI-assisted: Claude Code (Sonnet 4.6) Signed-off-by: Jan C. Borchardt <925062+jancborchardt@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
alperozturk96
requested changes
May 27, 2026
| import androidx.sqlite.db.SupportSQLiteDatabase | ||
|
|
||
| @Suppress("ClassName", "Detekt.ClassNaming") | ||
| class Migration_29_30 : Migration(29, 30) { |
Collaborator
There was a problem hiding this comment.
Auto migration should be enough to add new column to the note table
| final var defaultMode = getString(R.string.pref_value_mode_edit); | ||
| final var prefValueDirectEdit = getString(R.string.pref_value_mode_direct_edit); | ||
|
|
||
| if (noteId > 0) { |
Collaborator
There was a problem hiding this comment.
Please use early returns
| @@ -0,0 +1,756 @@ | |||
| { | |||
Collaborator
There was a problem hiding this comment.
Seems like 29.json never added before @tobiasKaminsky ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Nextcloud Notes for Android, currently the Preview/Edit toggle in the top right of the note detail view changes this setting for all notes. It would be nice to have the setting remembered implicitly per note.
This is nice if you have some notes which are usually more useful in view-mode, like a packlist or grocery list where you want to check off items.
Summary
noteModecolumn to theNotetable (DB migration 29 → 30) to persist each note's view mode locally29.jsonschema file required for the existing@AutoMigration(from = 28, to = 29)Resolves the existing TODO comment in
EditNoteActivity.close():How it works
getPreferenceMode()now checks the note's storednoteModefirst, and only falls back to the global SharedPreference if no per-note mode is set.changeMode()persists the new mode to the note immediately on toggle.Test plan
🤖 Generated with Claude Code