1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Support italic/bold for plain text

This commit is contained in:
M66B 2021-02-20 21:08:28 +01:00
parent c3a53af9c0
commit fdce3dee1a

View file

@ -1792,6 +1792,18 @@ public class HtmlHelper {
SpannableStringBuilder ssb = fromDocument(context, d, null, null);
for (StyleSpan span : ssb.getSpans(0, ssb.length(), StyleSpan.class)) {
int start = ssb.getSpanStart(span);
int end = ssb.getSpanEnd(span);
if (span.getStyle() == Typeface.ITALIC) {
ssb.insert(end, "*");
ssb.insert(start, "*");
} else if (span.getStyle() == Typeface.BOLD) {
ssb.insert(end, "**");
ssb.insert(start, "**");
}
}
for (URLSpan span : ssb.getSpans(0, ssb.length(), URLSpan.class)) {
String url = span.getURL();
if (TextUtils.isEmpty(url))