mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Use experiments settings for message sections
This commit is contained in:
parent
bdb5644367
commit
ec08b8e47f
1 changed files with 23 additions and 19 deletions
|
@ -327,6 +327,7 @@ public class HtmlHelper {
|
|||
boolean disable_tracking = prefs.getBoolean("disable_tracking", true);
|
||||
boolean parse_classes = prefs.getBoolean("parse_classes", false);
|
||||
boolean inline_images = prefs.getBoolean("inline_images", false);
|
||||
boolean experiments = prefs.getBoolean("experiments", false);
|
||||
|
||||
int textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
|
||||
|
||||
|
@ -792,7 +793,7 @@ public class HtmlHelper {
|
|||
if (hasVisibleContent(row.childNodes())) {
|
||||
Element next = row.nextElementSibling();
|
||||
if (next != null && "tr".equals(next.tagName()))
|
||||
row.appendElement("hr");
|
||||
row.appendElement(experiments ? "hr" : "br");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1809,6 +1810,7 @@ public class HtmlHelper {
|
|||
@Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean debug = prefs.getBoolean("debug", false);
|
||||
boolean experiments = prefs.getBoolean("experiments", false);
|
||||
|
||||
final int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
||||
final int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
||||
|
@ -2099,26 +2101,28 @@ public class HtmlHelper {
|
|||
newline(ssb.length());
|
||||
break;
|
||||
case "hr":
|
||||
int lhr = 0;
|
||||
for (LineSpan ls : ssb.getSpans(0, ssb.length(), LineSpan.class)) {
|
||||
int end = ssb.getSpanEnd(ls);
|
||||
if (end > lhr)
|
||||
lhr = end;
|
||||
}
|
||||
|
||||
boolean nls = true;
|
||||
for (int i = lhr; i < ssb.length(); i++)
|
||||
if (ssb.charAt(i) != '\n') {
|
||||
nls = false;
|
||||
break;
|
||||
if (experiments) {
|
||||
int lhr = 0;
|
||||
for (LineSpan ls : ssb.getSpans(0, ssb.length(), LineSpan.class)) {
|
||||
int end = ssb.getSpanEnd(ls);
|
||||
if (end > lhr)
|
||||
lhr = end;
|
||||
}
|
||||
if (nls)
|
||||
break;
|
||||
|
||||
while (ssb.length() > 1 &&
|
||||
ssb.charAt(ssb.length() - 2) == '\n' &&
|
||||
ssb.charAt(ssb.length() - 1) == '\n')
|
||||
ssb.delete(ssb.length() - 1, ssb.length());
|
||||
boolean nls = true;
|
||||
for (int i = lhr; i < ssb.length(); i++)
|
||||
if (ssb.charAt(i) != '\n') {
|
||||
nls = false;
|
||||
break;
|
||||
}
|
||||
if (nls)
|
||||
break;
|
||||
|
||||
while (ssb.length() > 1 &&
|
||||
ssb.charAt(ssb.length() - 2) == '\n' &&
|
||||
ssb.charAt(ssb.length() - 1) == '\n')
|
||||
ssb.delete(ssb.length() - 1, ssb.length());
|
||||
}
|
||||
|
||||
ssb.append("\n" + LINE + "\n");
|
||||
float stroke = context.getResources().getDisplayMetrics().density;
|
||||
|
|
Loading…
Reference in a new issue