From fe6f50200aa023653619aabefb5d910b4e1923b1 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 11 Dec 2021 10:16:34 +0100 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/AdapterMessage.java | 9 ++++++--- app/src/main/java/eu/faircode/email/Core.java | 2 +- app/src/main/java/eu/faircode/email/EntityMessage.java | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 68cd15831b..b754c810a8 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -3840,9 +3840,12 @@ public class AdapterMessage extends RecyclerView.Adapter 0) - sb.append('\n'); - sb.append(message.checkReplyDomain(context)); + String[] warning = message.checkReplyDomain(context); + if (warning != null) { + if (sb.length() > 0) + sb.append('\n'); + sb.append(context.getString(R.string.title_reply_domain, warning[0], warning[1])); + } } if (message.from != null && message.from.length > 0) { diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 6504f59dc7..61b42b4ef4 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -3795,7 +3795,7 @@ class Core { } if (!self) { - String warning = message.checkReplyDomain(context); + String[] warning = message.checkReplyDomain(context); message.reply_domain = (warning == null); } diff --git a/app/src/main/java/eu/faircode/email/EntityMessage.java b/app/src/main/java/eu/faircode/email/EntityMessage.java index 025a6450f0..08242070f4 100644 --- a/app/src/main/java/eu/faircode/email/EntityMessage.java +++ b/app/src/main/java/eu/faircode/email/EntityMessage.java @@ -307,7 +307,7 @@ public class EntityMessage implements Serializable { return hasKeyword(MessageHelper.FLAG_FORWARDED); } - String checkReplyDomain(Context context) { + String[] checkReplyDomain(Context context) { if (from == null || from.length == 0) return null; if (reply == null || reply.length == 0) @@ -328,7 +328,7 @@ public class EntityMessage implements Serializable { String fdomain = UriHelper.getParentDomain(context, f.substring(fat + 1)); if (!rdomain.equalsIgnoreCase(fdomain)) - return context.getString(R.string.title_reply_domain, fdomain, rdomain); + return new String[]{fdomain, rdomain}; } }