From 34b8888c8f573db334f8ad7f13e55a36492c5180 Mon Sep 17 00:00:00 2001 From: sk Date: Wed, 30 Nov 2022 11:04:19 +0100 Subject: [PATCH] add support for html code tag --- .../java/org/joinmastodon/android/ui/text/HtmlParser.java | 4 ++++ 1 file changed, 4 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 be120dd16..ee3874d5e 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,11 +1,14 @@ package org.joinmastodon.android.ui.text; import android.graphics.Typeface; +import android.graphics.fonts.FontFamily; +import android.graphics.fonts.FontStyle; 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.TypefaceSpan; import android.text.style.UnderlineSpan; import android.widget.TextView; @@ -128,6 +131,7 @@ public class HtmlParser{ 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)); + case "code" -> openSpans.add(new SpanInfo(new TypefaceSpan("monospace"), ssb.length(), el)); } } }