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 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;
}
}

@ -152,21 +152,21 @@ public class Status implements Serializable, Cloneable {
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference, Callback callback) {
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;
}
public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference, Callback callback) {
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;
}
public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference, Callback callback) {
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;
}

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

Loading…
Cancel
Save