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 disable_tracking = prefs.getBoolean("disable_tracking", true);
|
||||||
boolean parse_classes = prefs.getBoolean("parse_classes", false);
|
boolean parse_classes = prefs.getBoolean("parse_classes", false);
|
||||||
boolean inline_images = prefs.getBoolean("inline_images", false);
|
boolean inline_images = prefs.getBoolean("inline_images", false);
|
||||||
|
boolean experiments = prefs.getBoolean("experiments", false);
|
||||||
|
|
||||||
int textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
|
int textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
|
||||||
|
|
||||||
|
@ -792,7 +793,7 @@ public class HtmlHelper {
|
||||||
if (hasVisibleContent(row.childNodes())) {
|
if (hasVisibleContent(row.childNodes())) {
|
||||||
Element next = row.nextElementSibling();
|
Element next = row.nextElementSibling();
|
||||||
if (next != null && "tr".equals(next.tagName()))
|
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) {
|
@Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
boolean debug = prefs.getBoolean("debug", false);
|
boolean debug = prefs.getBoolean("debug", false);
|
||||||
|
boolean experiments = prefs.getBoolean("experiments", false);
|
||||||
|
|
||||||
final int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
final int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
||||||
final int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
final int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
||||||
|
@ -2099,26 +2101,28 @@ public class HtmlHelper {
|
||||||
newline(ssb.length());
|
newline(ssb.length());
|
||||||
break;
|
break;
|
||||||
case "hr":
|
case "hr":
|
||||||
int lhr = 0;
|
if (experiments) {
|
||||||
for (LineSpan ls : ssb.getSpans(0, ssb.length(), LineSpan.class)) {
|
int lhr = 0;
|
||||||
int end = ssb.getSpanEnd(ls);
|
for (LineSpan ls : ssb.getSpans(0, ssb.length(), LineSpan.class)) {
|
||||||
if (end > lhr)
|
int end = ssb.getSpanEnd(ls);
|
||||||
lhr = end;
|
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 (nls)
|
|
||||||
break;
|
|
||||||
|
|
||||||
while (ssb.length() > 1 &&
|
boolean nls = true;
|
||||||
ssb.charAt(ssb.length() - 2) == '\n' &&
|
for (int i = lhr; i < ssb.length(); i++)
|
||||||
ssb.charAt(ssb.length() - 1) == '\n')
|
if (ssb.charAt(i) != '\n') {
|
||||||
ssb.delete(ssb.length() - 1, ssb.length());
|
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");
|
ssb.append("\n" + LINE + "\n");
|
||||||
float stroke = context.getResources().getDisplayMetrics().density;
|
float stroke = context.getResources().getDisplayMetrics().density;
|
||||||
|
|
Loading…
Reference in a new issue