diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Poll.java b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Poll.java index ec5a37dbe..e9270f062 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Poll.java +++ b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Poll.java @@ -61,7 +61,7 @@ public class Poll implements Serializable { public transient Spannable span_title; public Spannable getSpanTitle(Context context, Status status, WeakReference viewWeakReference) { - span_title = SpannableHelper.convert(context, title, status, null, null, viewWeakReference); + span_title = SpannableHelper.convert(context, title, status, null, null, viewWeakReference, null, false); return span_title; } } diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java index f99475108..00549a0dc 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java @@ -95,12 +95,18 @@ public class SpannableHelper { public static Spannable convert(Context context, String text, Status status, Account account, Announcement announcement, WeakReference viewWeakReference) { - return convert(context, text, status, account, announcement, viewWeakReference, null); + return convert(context, text, status, account, announcement, viewWeakReference, null, true); } public static Spannable convert(Context context, String text, Status status, Account account, Announcement announcement, WeakReference viewWeakReference, Status.Callback callback) { + return convert(context, text, status, account, announcement, viewWeakReference, callback, true); + } + + public static Spannable convert(Context context, String text, + Status status, Account account, Announcement announcement, + WeakReference viewWeakReference, Status.Callback callback, boolean convertHtml) { if (text == null) { return null; } @@ -133,10 +139,14 @@ public class SpannableHelper { text = text.trim().replaceAll("\\s{3}", "   "); text = text.trim().replaceAll("\\s{2}", "  "); SpannableString initialContent; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) - initialContent = new SpannableString(Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)); - else - initialContent = new SpannableString(Html.fromHtml(text)); + if (convertHtml) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + initialContent = new SpannableString(Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)); + else + initialContent = new SpannableString(Html.fromHtml(text)); + } else { + initialContent = new SpannableString(text); + } //Get all links SpannableStringBuilder content = new SpannableStringBuilder(initialContent);