From 270ca1ceac5dd8fb570fd388956948a14968e603 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 25 Apr 2020 13:01:29 +0200 Subject: [PATCH] Custom rendering: added nested lists --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 7bba80d0a9..b221d37315 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -1775,6 +1775,7 @@ public class HtmlHelper { int colorAccent = Helper.resolveColor(context, R.attr.colorAccent); int dp3 = Helper.dp2pixels(context, 3); int dp6 = Helper.dp2pixels(context, 6); + int dp24 = Helper.dp2pixels(context, 24); if (experiments) { // https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements @@ -1963,6 +1964,15 @@ public class HtmlHelper { break; case "ol": case "ul": + int llevel = 0; + Element lparent = element.parent(); + while (lparent != null) { + if (lparent.tagName().equals(element.tagName())) + llevel++; + lparent = lparent.parent(); + } + if (llevel > 0) + ssb.setSpan(new LeadingMarginSpan.Standard(llevel * dp24), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); newline(start); newline(ssb.length()); break;