mirror of https://github.com/M66B/FairEmail.git
Text colors compatibility for Android < Nougat
This commit is contained in:
parent
828ed7a1a6
commit
a8a5ed99a1
|
@ -155,7 +155,9 @@ public class HtmlHelper {
|
||||||
// Font
|
// Font
|
||||||
for (Element font : document.select("font")) {
|
for (Element font : document.select("font")) {
|
||||||
String color = font.attr("color");
|
String color = font.attr("color");
|
||||||
font.removeAttr("color");
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
font.removeAttr("color");
|
||||||
|
font.removeAttr("face");
|
||||||
font.attr("style", "color:" + color + ";");
|
font.attr("style", "color:" + color + ";");
|
||||||
font.tagName("span");
|
font.tagName("span");
|
||||||
}
|
}
|
||||||
|
@ -215,6 +217,9 @@ public class HtmlHelper {
|
||||||
dark ? MIN_LUMINANCE - lum : lum - (1 - MIN_LUMINANCE));
|
dark ? MIN_LUMINANCE - lum : lum - (1 - MIN_LUMINANCE));
|
||||||
c = String.format("#%06x", color & 0xFFFFFF);
|
c = String.format("#%06x", color & 0xFFFFFF);
|
||||||
sb.append("color:").append(c).append(";");
|
sb.append("color:").append(c).append(";");
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
||||||
|
span.attr("color", c);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -492,6 +497,11 @@ public class HtmlHelper {
|
||||||
for (Element div : document.select("div"))
|
for (Element div : document.select("div"))
|
||||||
div.tagName("span");
|
div.tagName("span");
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
||||||
|
for (Element span : document.select("span"))
|
||||||
|
if (!TextUtils.isEmpty(span.attr("color")))
|
||||||
|
span.tagName("font");
|
||||||
|
|
||||||
Element body = document.body();
|
Element body = document.body();
|
||||||
return (body == null ? "" : body.html());
|
return (body == null ? "" : body.html());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue