Simplified quote/html

pull/199/head
M66B 4 years ago
parent 7a3ee41f41
commit eb110a581c

@ -29,6 +29,7 @@ import android.text.style.BulletSpan;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.text.style.LeadingMarginSpan;
import android.text.style.ParagraphStyle;
import android.text.style.QuoteSpan;
import android.text.style.RelativeSizeSpan;
@ -136,23 +137,25 @@ public class HtmlEx {
int option) {
int next;
for (int i = start; i < end; i = next) {
int n1 = text.nextSpanTransition(i, end, QuoteSpan.class);
int n2 = text.nextSpanTransition(i, end, eu.faircode.email.IndentSpan.class);
Class type = (n1 < n2 ? QuoteSpan.class : eu.faircode.email.IndentSpan.class);
next = Math.min(n1, n2);
Object[] quotes = text.getSpans(i, next, type);
for (Object quote : quotes) {
if (quote instanceof QuoteSpan)
out.append("<blockquote style=\"" +
eu.faircode.email.HtmlHelper.getQuoteStyle(text, next, end) + "\">");
else
next = text.nextSpanTransition(i, end, LeadingMarginSpan.class);
List<Object> spans = new ArrayList<>();
for (Object span : text.getSpans(i, next, LeadingMarginSpan.class))
if (span instanceof QuoteSpan ||
span instanceof eu.faircode.email.IndentSpan)
spans.add(span);
for (Object span : spans) {
if (span instanceof QuoteSpan)
out.append("<blockquote style=\"")
.append(eu.faircode.email.HtmlHelper.getQuoteStyle(text, next, end))
.append("\">");
else if (span instanceof eu.faircode.email.IndentSpan)
out.append("<blockquote>");
}
withinBlockquote(out, text, i, next, option);
for (Object quote : quotes) {
for (Object span : spans) {
out.append("</blockquote>\n");
}
}

Loading…
Cancel
Save