Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -249,40 +249,52 @@ private void replaceFragment() {


/**
* Returns the preferred mode for the account. If the mode is "remember last" the last mode is returned.
* If the mode is "direct edit" and the account does not support direct edit, the default mode is returned.
* Returns the preferred mode for the note. Checks the per-note stored mode first, then falls
* back to the global preference. If the mode is "remember last" the last mode is returned.
* If the mode is "direct edit" and the account does not support direct edit, edit mode is returned.
*/
private String getPreferenceMode(long accountId) {

final var prefKeyNoteMode = getString(R.string.pref_key_note_mode);
final var prefKeyLastMode = getString(R.string.pref_key_last_note_mode);
private String getPreferenceMode(long accountId, long noteId) {
final var defaultMode = getString(R.string.pref_value_mode_edit);
final var prefValueLast = getString(R.string.pref_value_mode_last);
final var prefValueDirectEdit = getString(R.string.pref_value_mode_direct_edit);

final Note note = noteId > 0 ? repo.getNoteById(noteId) : null;
final String storedMode = note == null ? null : note.getNoteMode();
if (storedMode != null) {
if (storedMode.equals(prefValueDirectEdit) && !isDirectEditingAvailable(accountId)) {
return defaultMode;
}
return storedMode;
}

final var preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
final String modePreference = preferences.getString(prefKeyNoteMode, defaultMode);
final var prefKeyNoteMode = getString(R.string.pref_key_note_mode);
final var prefValuePreview = getString(R.string.pref_value_mode_preview);

String effectiveMode = modePreference;
if (modePreference.equals(prefValueLast)) {
effectiveMode = preferences.getString(prefKeyLastMode, defaultMode);
final var preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String effectiveMode = preferences.getString(prefKeyNoteMode, defaultMode);

// A previously stored "remember last" value is no longer a valid mode; fall back to the default.
final boolean knownMode = effectiveMode.equals(defaultMode)
|| effectiveMode.equals(prefValuePreview)
|| effectiveMode.equals(prefValueDirectEdit);
if (!knownMode) {
effectiveMode = defaultMode;
}

if (effectiveMode.equals(prefValueDirectEdit)) {
final Account accountById = repo.getAccountById(accountId);
final var directEditAvailable = accountById != null && accountById.isDirectEditingAvailable();
if (!directEditAvailable) {
effectiveMode = defaultMode;
}
if (effectiveMode.equals(prefValueDirectEdit) && !isDirectEditingAvailable(accountId)) {
effectiveMode = defaultMode;
}

return effectiveMode;
}

private boolean isDirectEditingAvailable(long accountId) {
final Account account = repo.getAccountById(accountId);
return account != null && account.isDirectEditingAvailable();
}

private BaseNoteFragment getNoteFragment(long accountId, long noteId, final @Nullable String modePref) {

final var effectiveMode = modePref == null ? getPreferenceMode(accountId) : modePref;
final var effectiveMode = modePref == null ? getPreferenceMode(accountId, noteId) : modePref;

final var prefValueEdit = getString(R.string.pref_value_mode_edit);
final var prefValueDirectEdit = getString(R.string.pref_value_mode_direct_edit);
Expand All @@ -302,7 +314,7 @@ private BaseNoteFragment getNoteFragment(long accountId, long noteId, final @Nul

@NonNull
private BaseNoteFragment getNewNoteFragment(Note newNote) {
final var mode = getPreferenceMode(getAccountId());
final var mode = getPreferenceMode(getAccountId(), 0);

final var prefValueDirectEdit = getString(R.string.pref_value_mode_direct_edit);

Expand Down Expand Up @@ -397,18 +409,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
* Send result and closes the Activity
*/
public void close() {
/* TODO enhancement: store last mode in note
* for cross device functionality per note mode should be stored on the server.
*/
final var preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
final String prefKeyLastMode = getString(R.string.pref_key_last_note_mode);
if (fragment instanceof NoteEditFragment) {
preferences.edit().putString(prefKeyLastMode, getString(R.string.pref_value_mode_edit)).apply();
} else if (fragment instanceof NotePreviewFragment) {
preferences.edit().putString(prefKeyLastMode, getString(R.string.pref_value_mode_preview)).apply();
} else if (fragment instanceof NoteDirectEditFragment) {
preferences.edit().putString(prefKeyLastMode, getString(R.string.pref_value_mode_direct_edit)).apply();
}
fragment.onCloseNote();

if(isTaskRoot()) {
Expand All @@ -435,12 +435,17 @@ public void onNoteUpdated(Note note) {

@Override
public void changeMode(@NonNull Mode mode, boolean reloadNote) {
switch (mode) {
case EDIT -> launchExistingNote(getAccountId(), getNoteId(), getString(R.string.pref_value_mode_edit), reloadNote);
case PREVIEW -> launchExistingNote(getAccountId(), getNoteId(), getString(R.string.pref_value_mode_preview), reloadNote);
case DIRECT_EDIT -> launchExistingNote(getAccountId(), getNoteId(), getString(R.string.pref_value_mode_direct_edit), reloadNote);
final String modeString = switch (mode) {
case EDIT -> getString(R.string.pref_value_mode_edit);
case PREVIEW -> getString(R.string.pref_value_mode_preview);
case DIRECT_EDIT -> getString(R.string.pref_value_mode_direct_edit);
default -> throw new IllegalStateException("Unknown mode: " + mode);
};
final long noteId = getNoteId();
if (noteId > 0) {
repo.updateNoteMode(noteId, modeString);
}
launchExistingNote(getAccountId(), noteId, modeString, reloadNote);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@
NotesListWidgetData.class,
ShareEntity.class,
Capabilities.class
}, version = 29,
}, version = 30,
autoMigrations = {
@AutoMigration(from = 25, to = 26),
@AutoMigration(from = 26, to = 27),
@AutoMigration(from = 27, to = 28),
@AutoMigration(from = 28, to = 29),
@AutoMigration(from = 29, to = 30),
}
)
@TypeConverters({Converters.class})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ public void updateScrollY(long id, int scrollY) {
db.getNoteDao().updateScrollY(id, scrollY);
}

public void updateNoteMode(long id, @Nullable String noteMode) {
db.getNoteDao().updateNoteMode(id, noteMode);
}

public LiveData<List<CategoryWithNotesCount>> searchCategories$(Long accountId, String searchTerm) {
return db.getNoteDao().searchCategories$(accountId, searchTerm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package it.niedermann.owncloud.notes.persistence.dao;

import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
Expand Down Expand Up @@ -72,28 +73,28 @@
Integer countFavorites(long accountId);

@Query(searchRecentByModified)
LiveData<List<Note>> searchRecentByModified$(long accountId, String query);

Check warning on line 76 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 76 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 76 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 76 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchRecentByModified)
List<Note> searchRecentByModified(long accountId, String query);

Check warning on line 79 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 79 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 79 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 79 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchRecentLexicographically)
LiveData<List<Note>> searchRecentLexicographically$(long accountId, String query);

Check warning on line 82 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 82 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 82 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 82 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchRecentLexicographically)
List<Note> searchRecentLexicographically(long accountId, String query);

Check warning on line 85 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 85 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 85 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 85 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchFavoritesByModified)
LiveData<List<Note>> searchFavoritesByModified$(long accountId, String query);

Check warning on line 88 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 88 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 88 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 88 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchFavoritesByModified)
List<Note> searchFavoritesByModified(long accountId, String query);

Check warning on line 91 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 91 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 91 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 91 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchFavoritesLexicographically)
LiveData<List<Note>> searchFavoritesLexicographically$(long accountId, String query);

Check warning on line 94 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 94 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 94 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 94 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchFavoritesLexicographically)
List<Note> searchFavoritesLexicographically(long accountId, String query);

Check warning on line 97 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Lint

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 97 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Generate APK

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 97 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / Unit tests

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

Check warning on line 97 in app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java

View workflow job for this annotation

GitHub Actions / qa

it.niedermann.owncloud.notes.persistence.entity.Note has some properties [noteMode] which are not returned by the query. If they are not supposed to be read from the result, you can mark them with @ignore annotation. You can suppress this warning by annotating the function with @SuppressWarnings(RoomWarnings.QUERY_MISMATCH). Columns returned by the query: id, remoteId, accountId, title, favorite, isShared, readonly, excerpt, modified, category, status, eTag, content, scrollY.

@Query(searchUncategorizedByModified)
LiveData<List<Note>> searchUncategorizedByModified$(long accountId, String query);
Expand Down Expand Up @@ -125,6 +126,9 @@
@Query("UPDATE NOTE SET scrollY = :scrollY WHERE id = :id")
void updateScrollY(long id, int scrollY);

@Query("UPDATE NOTE SET noteMode = :noteMode WHERE id = :id")
void updateNoteMode(long id, @Nullable String noteMode);

@Query("UPDATE NOTE SET status = :status WHERE id = :id")
void updateStatus(long id, DBStatus status);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public class Note implements Serializable, Item {
@ColumnInfo(defaultValue = "0")
private int scrollY = 0;

@Nullable
@ColumnInfo(defaultValue = "NULL")
private String noteMode;

public Note() {
super();
}
Expand Down Expand Up @@ -272,6 +276,15 @@ public void setScrollY(int scrollY) {
this.scrollY = scrollY;
}

@Nullable
public String getNoteMode() {
return noteMode;
}

public void setNoteMode(@Nullable String noteMode) {
this.noteMode = noteMode;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<item>@string/pref_value_mode_edit</item>
<item>@string/pref_value_mode_preview</item>
<item>@string/pref_value_mode_direct_edit</item>
<item>@string/pref_value_mode_last</item>
</string-array>

<string-array name="fontSize_values">
Expand All @@ -32,7 +31,6 @@
<item>@string/noteMode_plain_edit</item>
<item>@string/noteMode_plain_preview</item>
<item>@string/noteMode_rich_edit</item>
<item>@string/noteMode_remember_last</item>
</string-array>

<string-array name="fontSize_entries" translatable="false">
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,13 @@
<string name="pref_key_lock" translatable="false">lock</string>
<string name="pref_key_prevent_screen_capture" translatable="false">preventScreenCapture</string>
<string name="pref_category_security" translatable="false">security</string>
<string name="pref_key_last_note_mode" translatable="false">lastNoteMode</string>
<string name="pref_key_background_sync" translatable="false">backgroundSync</string>
<string name="pref_key_enable_direct_edit" translatable="false">directEditPreference</string>
<string name="pref_key_show_ecosystem_apps" translatable="false">show_ecosystem_apps</string>
<string name="pref_key_swipe_actions" translatable="false">swipe_actions</string>
<string name="pref_value_mode_edit" translatable="false">edit</string>
<string name="pref_value_mode_direct_edit" translatable="false">directEdit</string>
<string name="pref_value_mode_preview" translatable="false">preview</string>
<string name="pref_value_mode_last" translatable="false">last</string>
<string name="pref_value_font_size_small" translatable="false">small</string>
<string name="pref_value_font_size_medium" translatable="false">medium</string>
<string name="pref_value_font_size_large" translatable="false">large</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
android:summary="@string/settings_show_ecosystem_apps_summary"/>

<ListPreference
android:defaultValue="@string/pref_value_mode_last"
android:defaultValue="@string/pref_value_mode_edit"
android:entries="@array/noteMode_entries_new"
android:entryValues="@array/noteMode_values"
android:icon="@drawable/ic_remove_red_eye_grey_24dp"
Expand Down
Loading