From c010734960e7daececaf60016bcc868150b7ff47 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 9 Feb 2021 15:08:38 +0100 Subject: [PATCH] Print attachments file names in header --- .../eu/faircode/email/FragmentMessages.java | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index dc431f3bc6..71f50ff845 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -7420,6 +7420,20 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. header.appendChild(span); } + for (EntityAttachment attachment : attachments) + if (attachment.isAttachment()) { + Element span = document.createElement("span"); + Element strong = document.createElement("strong"); + strong.text(context.getString(R.string.title_attachment)); + span.appendChild(strong); + if (!TextUtils.isEmpty(attachment.name)) + span.appendText(" " + attachment.name); + if (attachment.size != null) + span.appendText(" " + Helper.humanReadableByteCount(attachment.size)); + span.appendElement("br"); + header.appendChild(span); + } + if (!TextUtils.isEmpty(message.subject)) { Element span = document.createElement("span"); span.appendText(message.subject); @@ -7437,25 +7451,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. header.appendElement("hr").appendElement("br"); document.body().prependChild(header); - - boolean hasAttachments = false; - Element footer = document.createElement("p"); - footer.appendElement("br").appendElement("hr"); - for (EntityAttachment attachment : attachments) - if (attachment.isAttachment()) { - hasAttachments = true; - Element strong = document.createElement("strong"); - strong.text(context.getString(R.string.title_attachment)); - footer.appendChild(strong); - if (!TextUtils.isEmpty(attachment.name)) - footer.appendText(" " + attachment.name); - if (attachment.size != null) - footer.appendText(" " + Helper.humanReadableByteCount(attachment.size)); - footer.appendElement("br"); - } - - if (hasAttachments) - document.body().appendChild(footer); } return new String[]{message.subject, document.body().html()};