Skip to content

Commit

Permalink
Workaround for
Browse files Browse the repository at this point in the history
#37 Headlines rendered as normal text
#24 Line breaks ignored

bypass now renders the markdown on every call. caching is disabled now.
  • Loading branch information
stefan-niedermann committed Jan 2, 2016
1 parent 7df680b commit e26179c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions app/src/main/java/it/niedermann/owncloud/notes/model/Note.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class Note implements Item, Serializable {
private Calendar modified = null;
private String content = "";
private String excerpt = "";
private String spannableContent = null;

public Note(long id, Calendar modified, String title, String content) {
this.id = id;
Expand Down Expand Up @@ -55,7 +54,6 @@ public String getContent() {
public void setContent(String content) {
setExcerpt(content);
this.content = content;
this.spannableContent = null;
}

public String getExcerpt() {
Expand All @@ -66,11 +64,9 @@ private void setExcerpt(String content) {
excerpt = NoteUtil.generateNoteExcerpt(content);
}

public String getSpannableContent() {
if (spannableContent == null && getContent() != null) {
spannableContent = NoteUtil.parseMarkDown(getContent());
}
return spannableContent;
public CharSequence getSpannableContent() {
// TODO Cache the generated CharSequence not possible because CharSequence does not implement Serializable
return NoteUtil.parseMarkDown(getContent());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class NoteUtil {
* @param s String - MarkDown
* @return Spannable
*/
public static String parseMarkDown(String s) {
return bypass.markdownToSpannable(s).toString();
public static CharSequence parseMarkDown(String s) {
return bypass.markdownToSpannable(s);
}

/**
Expand Down

0 comments on commit e26179c

Please sign in to comment.