Support italic/bold for plain text

pull/194/head
M66B 4 years ago
parent c3a53af9c0
commit fdce3dee1a

@ -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))

Loading…
Cancel
Save