From d8d08306315193e78b4dcf9579c90c2fdb2b6bb0 Mon Sep 17 00:00:00 2001 From: sk Date: Wed, 30 Nov 2022 00:36:42 +0100 Subject: [PATCH] add support for more html tags closes #16 --- .../java/org/joinmastodon/android/ui/text/HtmlParser.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java b/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java index 000b70969..75de19a93 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java @@ -1,9 +1,12 @@ package org.joinmastodon.android.ui.text; +import android.graphics.Typeface; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; import android.text.style.BulletSpan; +import android.text.style.StyleSpan; +import android.text.style.UnderlineSpan; import android.widget.TextView; import com.twitter.twittertext.Regex; @@ -128,6 +131,9 @@ public class HtmlParser{ } } case "li" -> openSpans.add(new SpanInfo(new BulletSpan(V.dp(6)), ssb.length(), el)); + case "em", "i" -> openSpans.add(new SpanInfo(new StyleSpan(Typeface.ITALIC), ssb.length(), el)); + case "strong", "b" -> openSpans.add(new SpanInfo(new StyleSpan(Typeface.BOLD), ssb.length(), el)); + case "u" -> openSpans.add(new SpanInfo(new UnderlineSpan(), ssb.length(), el)); } } }