MCPcopy Create free account
hub / github.com/M66B/FairEmail / withinDiv

Method withinDiv

app/src/main/java/eu/faircode/email/HtmlEx.java:138–175  ·  view source on GitHub ↗
(StringBuilder out, Spanned text, int start, int end,
                                        int option)

Source from the content-addressed store, hash-verified

136 }
137
138 private /* static */ void withinDiv(StringBuilder out, Spanned text, int start, int end,
139 int option) {
140 int next;
141 for (int i = start; i < end; i = next) {
142 int n1 = nextSpanTransition(text, i, end, QuoteSpan.class);
143 int n2 = nextSpanTransition(text, i, end, eu.faircode.email.IndentSpan.class);
144 next = Math.min(n1, n2);
145 try {
146 List<Object> spans = new ArrayList<>();
147 for (Object span : getSpans(text, i, next, LeadingMarginSpan.class))
148 if (span instanceof QuoteSpan ||
149 span instanceof eu.faircode.email.IndentSpan)
150 spans.add(span);
151
152 for (Object span : spans) {
153 if (span instanceof QuoteSpan)
154 out.append("<blockquote style=\"")
155 .append(eu.faircode.email.HtmlHelper.getQuoteStyle(text, next, end))
156 .append("\">");
157 else if (span instanceof eu.faircode.email.IndentSpan)
158 out.append("<blockquote style=\"")
159 .append(eu.faircode.email.HtmlHelper.getIndentStyle(text, next, end))
160 .append("\">");
161 }
162
163 withinBlockquote(out, text, i, next, option);
164
165 for (Object span : spans) {
166 out.append("</blockquote>\n");
167 }
168 } catch (Throwable ex) {
169 Log.e("withinDiv " + start + "..." + end + "/" + text.length() +
170 " i=" + i + " n1=" + n1 + " n2=" + n2 +
171 "\n" + android.util.Log.getStackTraceString(ex));
172 throw ex;
173 }
174 }
175 }
176
177 private /* static */ String getTextDirection(Spanned text, int start, int end) {
178 try {

Callers 2

withinHtmlMethod · 0.95

Calls 10

nextSpanTransitionMethod · 0.95
getSpansMethod · 0.95
withinBlockquoteMethod · 0.95
eMethod · 0.95
minMethod · 0.80
getQuoteStyleMethod · 0.80
getIndentStyleMethod · 0.80
addMethod · 0.45
appendMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected