Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#528 Save the excerpt in a separate column #641

Merged
merged 5 commits into from
Dec 27, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
17 changes: 5 additions & 12 deletions app/src/main/java/it/niedermann/owncloud/notes/model/DBNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.io.Serializable;
import java.util.Calendar;

import it.niedermann.owncloud.notes.util.NoteUtil;

/**
* DBNote represents a single note from the local SQLite database with all attributes.
* It extends CloudNote with attributes required for local data management.
Expand All @@ -16,12 +14,12 @@ public class DBNote extends CloudNote implements Item, Serializable {
private long id;
private long accountId;
private DBStatus status;
private String excerpt = "";
private String excerpt;

public DBNote(long id, long remoteId, Calendar modified, String title, String content, boolean favorite, String category, String etag, DBStatus status, long accountId) {
public DBNote(long id, long remoteId, Calendar modified, String title, String content, boolean favorite, String category, String etag, DBStatus status, long accountId, String excerpt) {
super(remoteId, modified, title, content, favorite, category, etag);
this.id = id;
setExcerpt(content);
this.excerpt = excerpt;
this.status = status;
this.accountId = accountId;
}
Expand All @@ -46,17 +44,12 @@ public String getExcerpt() {
return excerpt;
}

public void setExcerptDirectly(String content) {
excerpt = content;
}

private void setExcerpt(String content) {
excerpt = NoteUtil.generateNoteExcerpt(content);
public void setExcerpt(String excerpt) {
this.excerpt = excerpt;
}

public void setContent(String content) {
super.setContent(content);
setExcerpt(content);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private DBNote colorTheNote(DBNote dbNote) {
matcher.start(), matcher.end(), 0);
}

dbNote.setExcerptDirectly(Html.toHtml(spannableString));
dbNote.setExcerpt(Html.toHtml(spannableString));
}

return dbNote;
Expand Down
Loading