From bab2741e294b889a85b920721e5b9b34e327d2b2 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 14 Feb 2020 12:45:52 +0100 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/AdapterMessage.java | 3 ++- app/src/main/java/eu/faircode/email/FragmentCompose.java | 6 ++++-- app/src/main/java/eu/faircode/email/MessageHelper.java | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index df16343d12..44a796a5fe 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -3790,7 +3790,8 @@ public class AdapterMessage extends RecyclerView.Adapter 0) from = ((InternetAddress) message.from[0]).getAddress(); - String text = HtmlHelper.getText(Helper.readText(file)); + String html = Helper.readText(file); + String text = HtmlHelper.getText(html); return new String[]{from, message.subject, text}; } diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 11139bc8dd..993a2056c3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -817,7 +817,8 @@ public class FragmentCompose extends FragmentBase { boolean plain = args.getBoolean("plain"); String body = args.getString("body"); - Document doc = JsoupEx.parse(Helper.readText(EntityMessage.getFile(context, id))); + String rhtml = Helper.readText(EntityMessage.getFile(context, id)); + Document doc = JsoupEx.parse(rhtml); Elements ref = doc.select("div[fairemail=reference]"); ref.removeAttr("fairemail"); @@ -3078,7 +3079,8 @@ public class FragmentCompose extends FragmentBase { div.appendChild(p); // Get referenced message body - Document d = JsoupEx.parse(Helper.readText(ref.getFile(context))); + String rhtml = Helper.readText(ref.getFile(context)); + Document d = JsoupEx.parse(rhtml); // Remove signature separators boolean remove_signatures = prefs.getBoolean("remove_signatures", false); diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 5846985d9b..242122be4b 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -452,7 +452,8 @@ public class MessageHelper { // https://www.ietf.org/rfc/rfc3798.txt Multipart report = new MimeMultipart("report; report-type=disposition-notification"); - String plainContent = HtmlHelper.getText(Helper.readText(message.getFile(context))); + String html = Helper.readText(message.getFile(context)); + String plainContent = HtmlHelper.getText(html); BodyPart plainPart = new MimeBodyPart(); plainPart.setContent(plainContent, "text/plain; charset=" + Charset.defaultCharset().name()); @@ -483,7 +484,8 @@ public class MessageHelper { } // Build html body - Document document = JsoupEx.parse(Helper.readText(message.getFile(context))); + String html = Helper.readText(message.getFile(context)); + Document document = JsoupEx.parse(html); // When sending message if (identity != null)