Apply markdown only for message content

pull/959/head
Thomas 1 year ago
parent ce92f23c50
commit b62982074a

@ -61,7 +61,7 @@ public class Poll implements Serializable {
public transient Spannable span_title; public transient Spannable span_title;
public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) { public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) {
span_title = SpannableHelper.convert(context, title, status, null, null, viewWeakReference, null, false); span_title = SpannableHelper.convert(context, title, status, null, null, viewWeakReference, null, false, false);
return span_title; return span_title;
} }
} }

@ -152,21 +152,21 @@ public class Status implements Serializable, Cloneable {
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference, Callback callback) { public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentSpan == null) { if (contentSpan == null) {
contentSpan = SpannableHelper.convert(context, content, this, null, null, viewWeakReference, callback); contentSpan = SpannableHelper.convert(context, content, this, null, null, viewWeakReference, callback, true);
} }
return contentSpan; return contentSpan;
} }
public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference, Callback callback) { public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentSpoilerSpan == null) { if (contentSpoilerSpan == null) {
contentSpoilerSpan = SpannableHelper.convert(context, spoiler_text, this, null, null, viewWeakReference, callback); contentSpoilerSpan = SpannableHelper.convert(context, spoiler_text, this, null, null, viewWeakReference, callback, false);
} }
return contentSpoilerSpan; return contentSpoilerSpan;
} }
public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference, Callback callback) { public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentTranslateSpan == null) { if (contentTranslateSpan == null) {
contentTranslateSpan = SpannableHelper.convert(context, translationContent, this, null, null, viewWeakReference, callback); contentTranslateSpan = SpannableHelper.convert(context, translationContent, this, null, null, viewWeakReference, callback, true);
} }
return contentTranslateSpan; return contentTranslateSpan;
} }

@ -108,13 +108,13 @@ public class SpannableHelper {
public static Spannable convert(Context context, String text, public static Spannable convert(Context context, String text,
Status status, Account account, Announcement announcement, WeakReference<View> viewWeakReference) { Status status, Account account, Announcement announcement, WeakReference<View> viewWeakReference) {
return convert(context, text, status, account, announcement, viewWeakReference, null, true); return convert(context, text, status, account, announcement, viewWeakReference, null, true, false);
} }
public static Spannable convert(Context context, String text, public static Spannable convert(Context context, String text,
Status status, Account account, Announcement announcement, Status status, Account account, Announcement announcement,
WeakReference<View> viewWeakReference, Status.Callback callback) { WeakReference<View> viewWeakReference, Status.Callback callback, boolean convertMarkdown) {
return convert(context, text, status, account, announcement, viewWeakReference, callback, true); return convert(context, text, status, account, announcement, viewWeakReference, callback, true, convertMarkdown);
} }
@ -135,7 +135,7 @@ public class SpannableHelper {
public static Spannable convert(Context context, String text, public static Spannable convert(Context context, String text,
Status status, Account account, Announcement announcement, Status status, Account account, Announcement announcement,
WeakReference<View> viewWeakReference, Status.Callback callback, boolean convertHtml) { WeakReference<View> viewWeakReference, Status.Callback callback, boolean convertHtml, boolean convertMarkdown) {
if (text == null) { if (text == null) {
return null; return null;
} }
@ -179,7 +179,7 @@ public class SpannableHelper {
boolean markdownSupport = sharedpreferences.getBoolean(context.getString(R.string.SET_MARKDOWN_SUPPORT), true); boolean markdownSupport = sharedpreferences.getBoolean(context.getString(R.string.SET_MARKDOWN_SUPPORT), true);
//Get all links //Get all links
SpannableStringBuilder content; SpannableStringBuilder content;
if (markdownSupport) { if (markdownSupport && convertMarkdown) {
MarkdownConverter markdownConverter = new MarkdownConverter(); MarkdownConverter markdownConverter = new MarkdownConverter();
markdownConverter.markdownItems = new ArrayList<>(); markdownConverter.markdownItems = new ArrayList<>();
int next; int next;

Loading…
Cancel
Save