Always suppress succesive lines

pull/189/head
M66B 4 years ago
parent 13d0ba2816
commit ed792c240b

@ -2250,34 +2250,33 @@ public class HtmlHelper {
setSpan(ssb, new StyleSpan(Typeface.BOLD), start, ssb.length()); setSpan(ssb, new StyleSpan(Typeface.BOLD), start, ssb.length());
break; break;
case "hr": case "hr":
boolean dashed = "true".equals(element.attr("x-dashed")); // Suppress succesive lines
if (dashed) { LineSpan[] lines = ssb.getSpans(0, ssb.length(), LineSpan.class);
LineSpan[] lines = ssb.getSpans(0, ssb.length(), LineSpan.class); int last = -1;
int last = -1; if (lines != null)
if (lines != null) for (LineSpan line : lines) {
for (LineSpan line : lines) { int e = ssb.getSpanEnd(line);
int e = ssb.getSpanEnd(line); if (e > last)
if (e > last) last = e;
last = e; }
} if (last >= 0) {
if (last >= 0) { boolean blank = true;
boolean blank = true; for (int i = last; i < ssb.length(); i++) {
for (int i = last; i < ssb.length(); i++) { char kar = ssb.charAt(i);
char kar = ssb.charAt(i); if (kar != ' ' && kar != '\n' && kar != '\u00a0') {
if (kar != ' ' && kar != '\n' && kar != '\u00a0') { blank = false;
blank = false;
break;
}
}
if (blank)
break; break;
}
} }
if (blank)
break;
} }
ssb.append(LINE); boolean dashed = "true".equals(element.attr("x-dashed"));
float stroke = context.getResources().getDisplayMetrics().density; float stroke = context.getResources().getDisplayMetrics().density;
float dash = (dashed ? dp3 : 0f); float dash = (dashed ? dp3 : 0f);
ssb.append(LINE);
setSpan(ssb, new LineSpan(colorSeparator, stroke, dash), start, ssb.length()); setSpan(ssb, new LineSpan(colorSeparator, stroke, dash), start, ssb.length());
break; break;
case "img": case "img":

Loading…
Cancel
Save