mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-27 09:46:50 +03:00
parent
eff22edc8f
commit
da67505c50
1 changed files with 22 additions and 23 deletions
|
@ -4,7 +4,6 @@ import android.content.SharedPreferences;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -76,28 +75,28 @@ public class NotePreviewFragment extends BaseNoteFragment {
|
||||||
markdownProcessor.factory(TextFactory.create());
|
markdownProcessor.factory(TextFactory.create());
|
||||||
markdownProcessor.config(
|
markdownProcessor.config(
|
||||||
MarkDownUtil.getMarkDownConfiguration(noteContent.getContext())
|
MarkDownUtil.getMarkDownConfiguration(noteContent.getContext())
|
||||||
.setOnTodoClickCallback((view, line, lineNumber) -> {
|
// .setOnTodoClickCallback((view, line, lineNumber) -> {
|
||||||
String[] lines = TextUtils.split(note.getContent(), "\\r?\\n");
|
// String[] lines = TextUtils.split(note.getContent(), "\\r?\\n");
|
||||||
/*
|
// /*
|
||||||
* Workaround for a bug when checkbox is the last line:
|
// * Workaround for a bug when checkbox is the last line:
|
||||||
* When (un)checking a checkbox which is in the last line, every time it gets toggled, the last character of the line gets lost.
|
// * When (un)checking a checkbox which is in the last line, every time it gets toggled, the last character of the line gets lost.
|
||||||
*/
|
// */
|
||||||
if ((lines.length - 1) == lineNumber) {
|
// if ((lines.length - 1) == lineNumber) {
|
||||||
if(lines[lineNumber].contains("- [ ]")) {
|
// if(lines[lineNumber].contains("- [ ]")) {
|
||||||
lines[lineNumber] = lines[lineNumber].replace("- [ ]", "- [x]");
|
// lines[lineNumber] = lines[lineNumber].replace("- [ ]", "- [x]");
|
||||||
} else {
|
// } else {
|
||||||
lines[lineNumber] = lines[lineNumber].replace("- [x]", "- [ ]");
|
// lines[lineNumber] = lines[lineNumber].replace("- [x]", "- [ ]");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
} else if (lines.length >= lineNumber) {
|
// } else if (lines.length >= lineNumber) {
|
||||||
lines[lineNumber] = line;
|
// lines[lineNumber] = line;
|
||||||
}
|
// }
|
||||||
changedText = TextUtils.join("\n", lines);
|
// changedText = TextUtils.join("\n", lines);
|
||||||
noteContent.setText(markdownProcessor.parse(changedText));
|
// noteContent.setText(markdownProcessor.parse(changedText));
|
||||||
saveNote(null);
|
// saveNote(null);
|
||||||
return line;
|
// return line;
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
.build());
|
.build());
|
||||||
setActiveTextView(noteContent);
|
setActiveTextView(noteContent);
|
||||||
noteContent.setText(markdownProcessor.parse(note.getContent()));
|
noteContent.setText(markdownProcessor.parse(note.getContent()));
|
||||||
|
|
Loading…
Reference in a new issue