Simplification

pull/210/head
M66B 2 years ago
parent be1ee1d5c5
commit b63806b392

@ -962,24 +962,16 @@ public class MessageHelper {
HtmlHelper.autoLink(document, true);
}
StringBuilder style = new StringBuilder();
if (compose_color != Color.TRANSPARENT)
document.head().append("<style>* {color: " + HtmlHelper.encodeWebColor(compose_color) + ";}</style>");
if (!TextUtils.isEmpty(compose_font)) {
List<Node> childs = new ArrayList<>();
for (Node child : document.body().childNodes())
if (TextUtils.isEmpty(child.attr("fairemail"))) {
childs.add(child);
child.remove();
} else
break;
style.append("* {color: ").append(HtmlHelper.encodeWebColor(compose_color)).append(";}").append('\n');
Element div = document.createElement("div").attr("style",
"font-family:" + StyleHelper.getFamily(compose_font));
for (Node child : childs)
div.appendChild(child);
document.body().prependChild(div);
}
if (!TextUtils.isEmpty(compose_font))
style.append("* {font-family: ").append(StyleHelper.getFamily(compose_font)).append(";}").append('\n');
if (style.length() > 0)
document.head().append("<style>" + style + "</style>");
document.select("div[fairemail=signature]").removeAttr("fairemail");
document.select("div[fairemail=reference]").removeAttr("fairemail");

Loading…
Cancel
Save