mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
9db632d2f5
commit
a2d4bec70c
|
@ -4262,17 +4262,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
// Limit number of nested block quotes
|
// Limit number of nested block quotes
|
||||||
boolean quote_limit = prefs.getBoolean("quote_limit", true);
|
boolean quote_limit = prefs.getBoolean("quote_limit", true);
|
||||||
if (quote_limit)
|
if (quote_limit)
|
||||||
for (Element bq : d.select("blockquote")) {
|
HtmlHelper.quoteLimit(d, MAX_QUOTE_LEVEL);
|
||||||
int level = 1;
|
|
||||||
Element parent = bq.parent();
|
|
||||||
while (parent != null) {
|
|
||||||
if ("blockquote".equals(parent.tagName()))
|
|
||||||
level++;
|
|
||||||
parent = parent.parent();
|
|
||||||
}
|
|
||||||
if (level >= MAX_QUOTE_LEVEL)
|
|
||||||
bq.html("…");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Selected text
|
// Selected text
|
||||||
|
|
|
@ -1989,6 +1989,20 @@ public class HtmlHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void quoteLimit(Document d, int maxLevel) {
|
||||||
|
for (Element bq : d.select("blockquote")) {
|
||||||
|
int level = 1;
|
||||||
|
Element parent = bq.parent();
|
||||||
|
while (parent != null) {
|
||||||
|
if ("blockquote".equals(parent.tagName()))
|
||||||
|
level++;
|
||||||
|
parent = parent.parent();
|
||||||
|
}
|
||||||
|
if (level >= maxLevel)
|
||||||
|
bq.html("…");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static boolean truncate(Document d, int max) {
|
static boolean truncate(Document d, int max) {
|
||||||
final int[] length = new int[1];
|
final int[] length = new int[1];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue