mirror of https://github.com/M66B/FairEmail.git
Silver bullet
This commit is contained in:
parent
2315dd3480
commit
7292d5d30f
|
@ -769,18 +769,18 @@ public class HtmlHelper {
|
||||||
|
|
||||||
// Lists
|
// Lists
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li
|
||||||
if (!view && !BuildConfig.DEBUG) {
|
if (!view) {
|
||||||
for (Element li : document.select("li")) {
|
for (Element li : document.select("li")) {
|
||||||
li.tagName("span");
|
|
||||||
Element parent = li.parent();
|
Element parent = li.parent();
|
||||||
if (parent == null || "ul".equals(parent.tagName()))
|
if (parent == null || "ul".equals(parent.tagName()))
|
||||||
li.prependText("• ");
|
continue; // li.prependText("• ");
|
||||||
else
|
else
|
||||||
li.prependText((li.elementSiblingIndex() + 1) + ". ");
|
li.prependText((li.elementSiblingIndex() + 1) + ". ");
|
||||||
|
li.tagName("span");
|
||||||
li.appendElement("br"); // line break after list item
|
li.appendElement("br"); // line break after list item
|
||||||
}
|
}
|
||||||
document.select("ol").tagName("div");
|
document.select("ol").tagName("div");
|
||||||
document.select("ul").tagName("div");
|
//document.select("ul").tagName("div");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tables
|
// Tables
|
||||||
|
@ -1730,7 +1730,7 @@ public class HtmlHelper {
|
||||||
if (node instanceof TextNode) {
|
if (node instanceof TextNode) {
|
||||||
String text = ((TextNode) node).text().trim();
|
String text = ((TextNode) node).text().trim();
|
||||||
Node next = node.nextSibling();
|
Node next = node.nextSibling();
|
||||||
if ((text.startsWith("* ") || text.startsWith("- ")) &&
|
if ((/*text.startsWith("* ") ||*/ text.startsWith("- ")) &&
|
||||||
(next == null || "br".equals(next.nodeName()))) {
|
(next == null || "br".equals(next.nodeName()))) {
|
||||||
item = true;
|
item = true;
|
||||||
String type = (text.startsWith("* ") ? "ul" : "ol");
|
String type = (text.startsWith("* ") ? "ul" : "ol");
|
||||||
|
@ -2181,7 +2181,6 @@ public class HtmlHelper {
|
||||||
newline(ssb.length());
|
newline(ssb.length());
|
||||||
Element parent = element.parent();
|
Element parent = element.parent();
|
||||||
if (parent == null || "ul".equals(parent.tagName()))
|
if (parent == null || "ul".equals(parent.tagName()))
|
||||||
// TODO BulletSpanCompat
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
||||||
ssb.setSpan(new BulletSpan(dp6, colorAccent), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
ssb.setSpan(new BulletSpan(dp6, colorAccent), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
else
|
else
|
||||||
|
@ -2212,8 +2211,6 @@ public class HtmlHelper {
|
||||||
}
|
}
|
||||||
if (llevel > 0)
|
if (llevel > 0)
|
||||||
ssb.setSpan(new LeadingMarginSpan.Standard(llevel * dp24), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
ssb.setSpan(new LeadingMarginSpan.Standard(llevel * dp24), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
newline(start);
|
|
||||||
newline(ssb.length());
|
|
||||||
break;
|
break;
|
||||||
case "small":
|
case "small":
|
||||||
ssb.setSpan(new RelativeSizeSpan(FONT_SMALL), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
ssb.setSpan(new RelativeSizeSpan(FONT_SMALL), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
@ -2290,8 +2287,16 @@ public class HtmlHelper {
|
||||||
flags.put(span, ssb.getSpanFlags(span));
|
flags.put(span, ssb.getSpanFlags(span));
|
||||||
ssb.removeSpan(span);
|
ssb.removeSpan(span);
|
||||||
}
|
}
|
||||||
for (int i = spans.length - 1; i >= 0; i--)
|
for (int i = spans.length - 1; i >= 0; i--) {
|
||||||
ssb.setSpan(spans[i], start.get(spans[i]), end.get(spans[i]), flags.get(spans[i]));
|
int s = start.get(spans[i]);
|
||||||
|
int e = end.get(spans[i]);
|
||||||
|
int f = flags.get(spans[i]);
|
||||||
|
if (spans[i] instanceof BulletSpan)
|
||||||
|
if (s > 1 && ssb.charAt(s - 1) == '\n' &&
|
||||||
|
e > 1 && ssb.charAt(e - 1) == '\n')
|
||||||
|
f |= Spanned.SPAN_PARAGRAPH;
|
||||||
|
ssb.setSpan(spans[i], s, e, f);
|
||||||
|
}
|
||||||
|
|
||||||
return ssb;
|
return ssb;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue