From 2b5ae57b067ca7c6627aedba368f188b608b4405 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 26 Sep 2018 18:04:01 +0000 Subject: [PATCH] Compose improvements --- .../eu/faircode/email/FragmentCompose.java | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index b6733373..2b87e5d9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -855,7 +855,7 @@ public class FragmentCompose extends FragmentEx { body = body.replaceAll("\\r?\\n", "
"); if (pro && !TextUtils.isEmpty(account.signature)) - body = "
" + account.signature + body; + body += account.signature; } else { draft.thread = ref.thread; @@ -889,35 +889,37 @@ public class FragmentCompose extends FragmentEx { } if ("reply".equals(action) || "reply_all".equals(action)) { - String text = ""; - if (answer > 0) { - text = db.answer().getAnswer(answer).text; - - String name = null; - String email = null; - if (draft.to != null && draft.to.length > 0) { - name = ((InternetAddress) draft.to[0]).getPersonal(); - email = ((InternetAddress) draft.to[0]).getAddress(); - } - text = text.replace("$name$", name == null ? "" : name); - text = text.replace("$email$", email == null ? "" : email); - } draft.subject = context.getString(R.string.title_subject_reply, ref.subject); - body = String.format("%s

%s %s:

%s
", - text.replaceAll("\\r?\\n", "
"), + body = String.format("

%s %s:

%s
", Html.escapeHtml(new Date().toString()), Html.escapeHtml(MessageHelper.getFormattedAddresses(draft.to, true)), HtmlHelper.sanitize(ref.read(context))); } else if ("forward".equals(action)) { draft.subject = context.getString(R.string.title_subject_forward, ref.subject); - body = String.format("

%s %s:

%s
", + body = String.format("

%s %s:

%s
", Html.escapeHtml(new Date().toString()), Html.escapeHtml(MessageHelper.getFormattedAddresses(ref.from, true)), HtmlHelper.sanitize(ref.read(context))); } if (pro && !TextUtils.isEmpty(account.signature)) - body = "
" + account.signature + body; + body = account.signature + body; + + if (answer > 0 && ("reply".equals(action) || "reply_all".equals(action))) { + String text = db.answer().getAnswer(answer).text; + + String name = null; + String email = null; + if (draft.to != null && draft.to.length > 0) { + name = ((InternetAddress) draft.to[0]).getPersonal(); + email = ((InternetAddress) draft.to[0]).getAddress(); + } + text = text.replace("$name$", name == null ? "" : name); + text = text.replace("$email$", email == null ? "" : email); + + body = text + body; + } else + body = "

" + body; } draft.content = true;