From ed792c240bb4051ed4d18a53e459900736dc07c6 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 15 Nov 2020 08:39:13 +0100 Subject: [PATCH] Always suppress succesive lines --- .../java/eu/faircode/email/HtmlHelper.java | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index d67f7e3a1c..c4d4a848d0 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -2250,34 +2250,33 @@ public class HtmlHelper { setSpan(ssb, new StyleSpan(Typeface.BOLD), start, ssb.length()); break; case "hr": - boolean dashed = "true".equals(element.attr("x-dashed")); - if (dashed) { - LineSpan[] lines = ssb.getSpans(0, ssb.length(), LineSpan.class); - int last = -1; - if (lines != null) - for (LineSpan line : lines) { - int e = ssb.getSpanEnd(line); - if (e > last) - last = e; - } - if (last >= 0) { - boolean blank = true; - for (int i = last; i < ssb.length(); i++) { - char kar = ssb.charAt(i); - if (kar != ' ' && kar != '\n' && kar != '\u00a0') { - blank = false; - break; - } - } - - if (blank) + // Suppress succesive lines + LineSpan[] lines = ssb.getSpans(0, ssb.length(), LineSpan.class); + int last = -1; + if (lines != null) + for (LineSpan line : lines) { + int e = ssb.getSpanEnd(line); + if (e > last) + last = e; + } + if (last >= 0) { + boolean blank = true; + for (int i = last; i < ssb.length(); i++) { + char kar = ssb.charAt(i); + if (kar != ' ' && kar != '\n' && kar != '\u00a0') { + blank = false; break; + } } + + if (blank) + break; } - ssb.append(LINE); + boolean dashed = "true".equals(element.attr("x-dashed")); float stroke = context.getResources().getDisplayMetrics().density; float dash = (dashed ? dp3 : 0f); + ssb.append(LINE); setSpan(ssb, new LineSpan(colorSeparator, stroke, dash), start, ssb.length()); break; case "img":