mirror of
https://github.com/leanote/leanote-android.git
synced 2025-10-15 06:40:58 +00:00
修复笔记内容太多 预览出现anr
This commit is contained in:
@@ -202,9 +202,9 @@ public class NoteAdapter extends RecyclerView.Adapter<NoteAdapter.NoteHolder> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (note.isMarkDown()) {
|
if (note.isMarkDown()) {
|
||||||
holder.contentTv.setText(note.getContent());
|
holder.contentTv.setText(note.getNoteAbstract());
|
||||||
} else {
|
} else {
|
||||||
Spanned spannedContent = Html.fromHtml(note.getContent());
|
Spanned spannedContent = Html.fromHtml(note.getNoteAbstract());
|
||||||
String contentStr = spannedContent.toString();
|
String contentStr = spannedContent.toString();
|
||||||
contentStr = contentStr.replaceAll("\\n\\n+", "\n");
|
contentStr = contentStr.replaceAll("\\n\\n+", "\n");
|
||||||
holder.contentTv.setText(contentStr);
|
holder.contentTv.setText(contentStr);
|
||||||
|
@@ -104,12 +104,15 @@ public class NoteService {
|
|||||||
localId = localNote.getId();
|
localId = localNote.getId();
|
||||||
}
|
}
|
||||||
remoteNote.setIsDirty(false);
|
remoteNote.setIsDirty(false);
|
||||||
|
String content;
|
||||||
if (remoteNote.isMarkDown()) {
|
if (remoteNote.isMarkDown()) {
|
||||||
remoteNote.setContent(convertToLocalImageLinkForMD(localId, remoteNote.getContent()));
|
content = convertToLocalImageLinkForMD(localId, remoteNote.getContent());
|
||||||
} else {
|
} else {
|
||||||
remoteNote.setContent(convertToLocalImageLinkForRichText(localId, remoteNote.getContent()));
|
content = convertToLocalImageLinkForRichText(localId, remoteNote.getContent());
|
||||||
}
|
}
|
||||||
XLog.i(TAG + "content=" + remoteNote.getContent());
|
XLog.i(TAG + "content=" + remoteNote.getContent());
|
||||||
|
remoteNote.setContent(content);
|
||||||
|
remoteNote.setNoteAbstract(content.length() < 500 ? content : content.substring(0, 500));
|
||||||
remoteNote.update();
|
remoteNote.update();
|
||||||
handleFile(localId, remoteNote.getNoteFiles());
|
handleFile(localId, remoteNote.getNoteFiles());
|
||||||
updateTagsToLocal(localId, remoteNote.getTagData());
|
updateTagsToLocal(localId, remoteNote.getTagData());
|
||||||
|
Reference in New Issue
Block a user