diff --git a/patches/Html.patch b/patches/Html.patch
new file mode 100644
index 0000000000..aa21d7bc91
--- /dev/null
+++ b/patches/Html.patch
@@ -0,0 +1,272 @@
+diff --git a/app/src/main/java/eu/faircode/email/HtmlEx.java b/app/src/main/java/eu/faircode/email/HtmlEx.java
+index af06a672b..bbfcdc5fc 100644
+--- a/app/src/main/java/eu/faircode/email/HtmlEx.java
++++ b/app/src/main/java/eu/faircode/email/HtmlEx.java
+@@ -55,7 +55,7 @@ public class HtmlEx {
+ * @deprecated use {@link #toHtml(Spanned, int)} instead.
+ */
+ @Deprecated
+- public /* static */ String toHtml(Spanned text) {
++ public static String toHtml(Spanned text) {
+ return toHtml(text, TO_HTML_PARAGRAPH_LINES_CONSECUTIVE);
+ }
+
+@@ -69,7 +69,7 @@ public class HtmlEx {
+ * {@link #TO_HTML_PARAGRAPH_LINES_INDIVIDUAL}
+ * @return string containing input converted to HTML
+ */
+- public /* static */ String toHtml(Spanned text, int option) {
++ public static String toHtml(Spanned text, int option) {
+ StringBuilder out = new StringBuilder();
+ withinHtml(out, text, option);
+ return out.toString();
+@@ -78,13 +78,13 @@ public class HtmlEx {
+ /**
+ * Returns an HTML escaped representation of the given plain text.
+ */
+- public /* static */ String escapeHtml(CharSequence text) {
++ public static String escapeHtml(CharSequence text) {
+ StringBuilder out = new StringBuilder();
+ withinStyle(out, text, 0, text.length());
+ return out.toString();
+ }
+
+- private /* static */ void withinHtml(StringBuilder out, Spanned text, int option) {
++ private static void withinHtml(StringBuilder out, Spanned text, int option) {
+ if ((option & TO_HTML_PARAGRAPH_FLAG) == TO_HTML_PARAGRAPH_LINES_CONSECUTIVE) {
+ encodeTextAlignmentByDiv(out, text, option);
+ return;
+@@ -93,7 +93,7 @@ public class HtmlEx {
+ withinDiv(out, text, 0, text.length(), option);
+ }
+
+- private /* static */ void encodeTextAlignmentByDiv(StringBuilder out, Spanned text, int option) {
++ private static void encodeTextAlignmentByDiv(StringBuilder out, Spanned text, int option) {
+ int len = text.length();
+
+ int next;
+@@ -129,7 +129,7 @@ public class HtmlEx {
+ }
+ }
+
+- private /* static */ void withinDiv(StringBuilder out, Spanned text, int start, int end,
++ private static void withinDiv(StringBuilder out, Spanned text, int start, int end,
+ int option) {
+ int next;
+ for (int i = start; i < end; i = next) {
+@@ -148,7 +148,7 @@ public class HtmlEx {
+ }
+ }
+
+- private /* static */ String getTextDirection(Spanned text, int start, int end) {
++ private static String getTextDirection(Spanned text, int start, int end) {
+ if (TextDirectionHeuristics.FIRSTSTRONG_LTR.isRtl(text, start, end - start)) {
+ return " dir=\"rtl\"";
+ } else {
+@@ -156,7 +156,7 @@ public class HtmlEx {
+ }
+ }
+
+- private /* static */ String getTextStyles(Spanned text, int start, int end,
++ private static String getTextStyles(Spanned text, int start, int end,
+ boolean forceNoVerticalMargin, boolean includeTextAlign) {
+ String margin = null;
+ String textAlign = null;
+@@ -200,7 +200,7 @@ public class HtmlEx {
+ return style.append("\"").toString();
+ }
+
+- private /* static */ void withinBlockquote(StringBuilder out, Spanned text, int start, int end,
++ private static void withinBlockquote(StringBuilder out, Spanned text, int start, int end,
+ int option) {
+ if ((option & TO_HTML_PARAGRAPH_FLAG) == TO_HTML_PARAGRAPH_LINES_CONSECUTIVE) {
+ withinBlockquoteConsecutive(out, text, start, end);
+@@ -209,9 +209,9 @@ public class HtmlEx {
+ }
+ }
+
+- private /* static */ void withinBlockquoteIndividual(StringBuilder out, Spanned text, int start,
++ private static void withinBlockquoteIndividual(StringBuilder out, Spanned text, int start,
+ int end) {
+- Boolean isInBulletList = null;
++ boolean isInList = false;
+ int next;
+ for (int i = start; i <= end; i = next) {
+ next = TextUtils.indexOf(text, '\n', i, end);
+@@ -220,48 +220,42 @@ public class HtmlEx {
+ }
+
+ if (next == i) {
+- if (isInBulletList != null) {
++ if (isInList) {
+ // Current paragraph is no longer a list item; close the previously opened list
+- out.append(isInBulletList ? "\n" : "\n");
+- isInBulletList = null;
++ isInList = false;
++ out.append("\n");
+ }
+- if (i != text.length())
+- out.append("
\n");
++ out.append("
\n");
+ } else {
+- Boolean isBulletListItem = null;
++ boolean isListItem = false;
+ ParagraphStyle[] paragraphStyles = text.getSpans(i, next, ParagraphStyle.class);
+ for (ParagraphStyle paragraphStyle : paragraphStyles) {
+ final int spanFlags = text.getSpanFlags(paragraphStyle);
+ if ((spanFlags & Spanned.SPAN_PARAGRAPH) == Spanned.SPAN_PARAGRAPH
+ && paragraphStyle instanceof BulletSpan) {
+- isBulletListItem = !(paragraphStyle instanceof eu.faircode.email.NumberSpan);
++ isListItem = true;
+ break;
+ }
+ }
+
+- if (isBulletListItem != null && isInBulletList != null && isBulletListItem != isInBulletList) {
+- out.append(isInBulletList ? "\n" : "\n");
+- isInBulletList = null;
+- }
+-
+- if (isBulletListItem != null && isInBulletList == null) {
++ if (isListItem && !isInList) {
+ // Current paragraph is the first item in a list
+- isInBulletList = isBulletListItem;
+- out.append(isInBulletList ? "
");
+
+ int next;
+ for (int i = start; i < end; i = next) {
+@@ -302,24 +294,24 @@ public class HtmlEx {
+
+ withinParagraph(out, text, i, next - nl);
+
+- if (nl == 0) {
++ if (nl == 1) {
+ out.append("
\n");
+ } else {
+- for (int j = 0; j < nl; j++) {
++ for (int j = 2; j < nl; j++) {
+ out.append("
");
+ }
+ if (next != end) {
+ /* Paragraph should be closed and reopened */
+- out.append("
"); + } + } + } + +- out.append("
\n"); ++ out.append("\n"); + } + +- private /* static */ void withinParagraph(StringBuilder out, Spanned text, int start, int end) { ++ private static void withinParagraph(StringBuilder out, Spanned text, int start, int end) { + int next; + for (int i = start; i < end; i = next) { + next = text.nextSpanTransition(i, end, CharacterStyle.class); +@@ -339,11 +331,9 @@ public class HtmlEx { + if (style[j] instanceof TypefaceSpan) { + String s = ((TypefaceSpan) style[j]).getFamily(); + +- //if ("monospace".equals(s)) { +- // out.append(""); +- //} +- +- out.append(""); ++ if ("monospace".equals(s)) { ++ out.append(""); ++ } + } + if (style[j] instanceof SuperscriptSpan) { + out.append(""); +@@ -374,8 +364,8 @@ public class HtmlEx { + AbsoluteSizeSpan s = ((AbsoluteSizeSpan) style[j]); + float sizeDip = s.getSize(); + if (!s.getDip()) { +- //Application application = ActivityThread.currentApplication(); +- sizeDip /= context.getResources().getDisplayMetrics().density; ++ Application application = ActivityThread.currentApplication(); ++ sizeDip /= application.getResources().getDisplayMetrics().density; + } + + // px in CSS is the equivalance of dip in Android +@@ -427,13 +417,11 @@ public class HtmlEx { + out.append(""); + } + if (style[j] instanceof TypefaceSpan) { +- //String s = ((TypefaceSpan) style[j]).getFamily(); +- +- //if (s.equals("monospace")) { +- // out.append(""); +- //} ++ String s = ((TypefaceSpan) style[j]).getFamily(); + +- out.append(""); ++ if (s.equals("monospace")) { ++ out.append(""); ++ } + } + if (style[j] instanceof StyleSpan) { + int s = ((StyleSpan) style[j]).getStyle(); +@@ -449,8 +437,8 @@ public class HtmlEx { + } + } + +- //@UnsupportedAppUsage +- private /* static */ void withinStyle(StringBuilder out, CharSequence text, ++ @UnsupportedAppUsage ++ private static void withinStyle(StringBuilder out, CharSequence text, + int start, int end) { + for (int i = start; i < end; i++) { + char c = text.charAt(i); diff --git a/patches/HtmlEx.patch b/patches/HtmlEx.patch deleted file mode 100644 index 6ca1687bd2..0000000000 --- a/patches/HtmlEx.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/app/src/main/java/eu/faircode/email/HtmlEx.java b/app/src/main/java/eu/faircode/email/HtmlEx.java -index c8b8e1b8f..5cfceaccd 100644 ---- a/app/src/main/java/eu/faircode/email/HtmlEx.java -+++ b/app/src/main/java/eu/faircode/email/HtmlEx.java -@@ -276,7 +276,7 @@ public class HtmlEx { - - private /* static */ void withinBlockquoteConsecutive(StringBuilder out, Spanned text, int start, - int end) { -- out.append("");
-+ out.append("");
-
- int next;
- for (int i = start; i < end; i = next) {
-@@ -294,21 +294,21 @@ public class HtmlEx {
-
- withinParagraph(out, text, i, next - nl);
-
-- if (nl == 1) {
-+ if (nl == 0) {
- out.append("
\n");
- } else {
-- for (int j = 2; j < nl; j++) {
-+ for (int j = 0; j < nl; j++) {
- out.append("
");
- }
- if (next != end) {
- /* Paragraph should be closed and reopened */
-- out.append("
"); -+ out.append("\n"); -+ out.append(""); - } - } - } - -- out.append("
\n"); -+ out.append("\n"); - } - - private /* static */ void withinParagraph(StringBuilder out, Spanned text, int start, int end) { diff --git a/patches/HtmlExNumber.patch b/patches/HtmlExNumber.patch deleted file mode 100644 index db7c66386c..0000000000 --- a/patches/HtmlExNumber.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/app/src/main/java/eu/faircode/email/HtmlEx.java b/app/src/main/java/eu/faircode/email/HtmlEx.java -index 5cfceaccd..f6db9f051 100644 ---- a/app/src/main/java/eu/faircode/email/HtmlEx.java -+++ b/app/src/main/java/eu/faircode/email/HtmlEx.java -@@ -211,7 +211,7 @@ public class HtmlEx { - - private /* static */ void withinBlockquoteIndividual(StringBuilder out, Spanned text, int start, - int end) { -- boolean isInList = false; -+ Boolean isInBulletList = null; - int next; - for (int i = start; i <= end; i = next) { - next = TextUtils.indexOf(text, '\n', i, end); -@@ -220,42 +220,47 @@ public class HtmlEx { - } - - if (next == i) { -- if (isInList) { -+ if (isInBulletList != null) { - // Current paragraph is no longer a list item; close the previously opened list -- isInList = false; -- out.append("\n"); -+ out.append(isInBulletList ? "\n" : "\n"); -+ isInBulletList = null; - } - out.append("