mirror of https://github.com/M66B/FairEmail.git
Custom renderL fixed image location
This commit is contained in:
parent
b52c3b0386
commit
5adee09a3f
|
@ -1774,6 +1774,16 @@ public class HtmlHelper {
|
||||||
if (node instanceof Element) {
|
if (node instanceof Element) {
|
||||||
Element element = (Element) node;
|
Element element = (Element) node;
|
||||||
element.attr("start-index", Integer.toString(ssb.length()));
|
element.attr("start-index", Integer.toString(ssb.length()));
|
||||||
|
switch (element.tagName()) {
|
||||||
|
case "img":
|
||||||
|
String src = element.attr("src");
|
||||||
|
Drawable d = (imageGetter == null
|
||||||
|
? context.getDrawable(R.drawable.baseline_broken_image_24)
|
||||||
|
: imageGetter.getDrawable(src));
|
||||||
|
ssb.append("\uFFFC"); // Object replacement character
|
||||||
|
ssb.setSpan(new ImageSpan(d, src), ssb.length() - 1, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else if (node instanceof TextNode) {
|
} else if (node instanceof TextNode) {
|
||||||
TextNode tnode = (TextNode) node;
|
TextNode tnode = (TextNode) node;
|
||||||
ssb.append(tnode.text());
|
ssb.append(tnode.text());
|
||||||
|
@ -1816,14 +1826,7 @@ public class HtmlHelper {
|
||||||
ssb.setSpan(new StyleSpan(Typeface.BOLD), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
ssb.setSpan(new StyleSpan(Typeface.BOLD), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
break;
|
break;
|
||||||
case "img":
|
case "img":
|
||||||
if (imageGetter == null) {
|
// Do nothing
|
||||||
Log.e("img without getter");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
String src = element.attr("src");
|
|
||||||
Drawable d = imageGetter.getDrawable(src);
|
|
||||||
ssb.append("\uFFFC"); // Object replacement character
|
|
||||||
ssb.setSpan(new ImageSpan(d, src), ssb.length() - 1, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue