mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-26 23:27:55 +03:00
parent
e9c0d853ac
commit
50d853ed9d
4 changed files with 8 additions and 8 deletions
|
@ -114,7 +114,7 @@ public abstract class BaseNoteFragment extends BrandedFragment implements Catego
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
throw new IllegalArgumentException(PARAM_NOTE_ID + " is not given, argument " + PARAM_NEWNOTE + " is missing and " + PARAM_CONTENT + " is missing.");
|
throw new IllegalArgumentException(PARAM_NOTE_ID + " is not given, argument " + PARAM_NEWNOTE + " is missing and " + PARAM_CONTENT + " is missing.");
|
||||||
} else {
|
} else {
|
||||||
note = new Note(-1, -1, null, NoteUtil.generateNoteTitle(content), content, false, getString(R.string.category_readonly), null, DBStatus.VOID, -1, "", 0);
|
note = new Note(-1, -1L, null, NoteUtil.generateNoteTitle(content), content, false, getString(R.string.category_readonly), null, DBStatus.VOID, -1, "", 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
note = db.getNoteDao().getNote(localAccount.getId(), db.addNoteAndSync(ssoAccount, localAccount.getId(), cloudNote));
|
note = db.getNoteDao().getNote(localAccount.getId(), db.addNoteAndSync(ssoAccount, localAccount.getId(), cloudNote));
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class EditNoteActivity extends LockedActivity implements BaseNoteFragment
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
content = "";
|
content = "";
|
||||||
}
|
}
|
||||||
Note newNote = new Note(0, Calendar.getInstance(), NoteUtil.generateNonEmptyNoteTitle(content, this), content, favorite, category, null);
|
Note newNote = new Note(null, Calendar.getInstance(), NoteUtil.generateNonEmptyNoteTitle(content, this), content, favorite, category, null);
|
||||||
fragment = NoteEditFragment.newInstanceWithNewNote(newNote);
|
fragment = NoteEditFragment.newInstanceWithNewNote(newNote);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container_view, fragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container_view, fragment).commit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ public abstract class NotesDatabase extends RoomDatabase {
|
||||||
* @param note Note
|
* @param note Note
|
||||||
*/
|
*/
|
||||||
public long addNoteAndSync(SingleSignOnAccount ssoAccount, long accountId, Note note) {
|
public long addNoteAndSync(SingleSignOnAccount ssoAccount, long accountId, Note note) {
|
||||||
Note entity = new Note(0, 0, note.getModified(), note.getTitle(), note.getContent(), note.getFavorite(), note.getCategory(), note.getETag(), DBStatus.LOCAL_EDITED, accountId, generateNoteExcerpt(note.getContent(), note.getTitle()), 0);
|
Note entity = new Note(0, null, note.getModified(), note.getTitle(), note.getContent(), note.getFavorite(), note.getCategory(), note.getETag(), DBStatus.LOCAL_EDITED, accountId, generateNoteExcerpt(note.getContent(), note.getTitle()), 0);
|
||||||
long id = addNote(accountId, entity);
|
long id = addNote(accountId, entity);
|
||||||
notifyWidgets();
|
notifyWidgets();
|
||||||
serverSyncHelper.scheduleSync(ssoAccount, true);
|
serverSyncHelper.scheduleSync(ssoAccount, true);
|
||||||
|
@ -179,7 +179,7 @@ public abstract class NotesDatabase extends RoomDatabase {
|
||||||
entity.setAccountId(accountId);
|
entity.setAccountId(accountId);
|
||||||
entity.setExcerpt(generateNoteExcerpt(note.getContent(), note.getTitle()));
|
entity.setExcerpt(generateNoteExcerpt(note.getContent(), note.getTitle()));
|
||||||
}
|
}
|
||||||
if (note.getRemoteId() > 0) {
|
if (note.getRemoteId() != null && note.getRemoteId() > 0) {
|
||||||
entity.setRemoteId(note.getRemoteId());
|
entity.setRemoteId(note.getRemoteId());
|
||||||
}
|
}
|
||||||
entity.setTitle(note.getTitle());
|
entity.setTitle(note.getTitle());
|
||||||
|
@ -194,7 +194,7 @@ public abstract class NotesDatabase extends RoomDatabase {
|
||||||
|
|
||||||
public void moveNoteToAnotherAccount(SingleSignOnAccount ssoAccount, long oldAccountId, Note note, long newAccountId) {
|
public void moveNoteToAnotherAccount(SingleSignOnAccount ssoAccount, long oldAccountId, Note note, long newAccountId) {
|
||||||
// Add new note
|
// Add new note
|
||||||
addNoteAndSync(ssoAccount, newAccountId, new Note(0, note.getModified(), note.getTitle(), note.getContent(), note.getFavorite(), note.getCategory(), null));
|
addNoteAndSync(ssoAccount, newAccountId, new Note(null, note.getModified(), note.getTitle(), note.getContent(), note.getFavorite(), note.getCategory(), null));
|
||||||
deleteNoteAndSync(ssoAccount, note.getId());
|
deleteNoteAndSync(ssoAccount, note.getId());
|
||||||
|
|
||||||
notifyWidgets();
|
notifyWidgets();
|
||||||
|
@ -261,7 +261,7 @@ public abstract class NotesDatabase extends RoomDatabase {
|
||||||
if (newTitle != null) {
|
if (newTitle != null) {
|
||||||
title = newTitle;
|
title = newTitle;
|
||||||
} else {
|
} else {
|
||||||
if (oldNote.getRemoteId() == 0 || localAccount.getPreferredApiVersion() == null || localAccount.getPreferredApiVersion().compareTo(new ApiVersion("1.0", 0, 0)) < 0) {
|
if (oldNote.getRemoteId() == null || oldNote.getRemoteId() == 0 || localAccount.getPreferredApiVersion() == null || localAccount.getPreferredApiVersion().compareTo(new ApiVersion("1.0", 0, 0)) < 0) {
|
||||||
title = NoteUtil.generateNonEmptyNoteTitle(newContent, context);
|
title = NoteUtil.generateNonEmptyNoteTitle(newContent, context);
|
||||||
} else {
|
} else {
|
||||||
title = oldNote.getTitle();
|
title = oldNote.getTitle();
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class Note implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
public Note(long remoteId, Calendar modified, String title, String content, Boolean favorite, String category, String eTag) {
|
public Note(Long remoteId, Calendar modified, String title, String content, Boolean favorite, String category, String eTag) {
|
||||||
this.remoteId = remoteId;
|
this.remoteId = remoteId;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.modified = modified;
|
this.modified = modified;
|
||||||
|
@ -75,7 +75,7 @@ public class Note implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
public Note(long id, long remoteId, Calendar modified, String title, String content, boolean favorite, String category, String etag, DBStatus status, long accountId, @NonNull String excerpt, Integer scrollY) {
|
public Note(long id, Long remoteId, Calendar modified, String title, String content, boolean favorite, String category, String etag, DBStatus status, long accountId, @NonNull String excerpt, Integer scrollY) {
|
||||||
this(remoteId, modified, title, content, favorite, category, etag);
|
this(remoteId, modified, title, content, favorite, category, etag);
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
|
Loading…
Reference in a new issue