From b7df1875accf0d72008ff0d8f4a7f3244500970c Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 2 May 2019 13:34:42 +0200 Subject: [PATCH] Add recipient to create rule --- app/src/main/java/eu/faircode/email/AdapterMessage.java | 2 ++ app/src/main/java/eu/faircode/email/FragmentRule.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 0d05e67234..ce5c6c7e90 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -2395,6 +2395,8 @@ public class AdapterMessage extends RecyclerView.Adapter 0) rule.putExtra("sender", ((InternetAddress) data.message.from[0]).getAddress()); + if (data.message.to != null && data.message.to.length > 0) + rule.putExtra("recipient", ((InternetAddress) data.message.to[0]).getAddress()); if (!TextUtils.isEmpty(data.message.subject)) rule.putExtra("subject", data.message.subject); diff --git a/app/src/main/java/eu/faircode/email/FragmentRule.java b/app/src/main/java/eu/faircode/email/FragmentRule.java index a7e70a81ea..3d766deec4 100644 --- a/app/src/main/java/eu/faircode/email/FragmentRule.java +++ b/app/src/main/java/eu/faircode/email/FragmentRule.java @@ -371,6 +371,7 @@ public class FragmentRule extends FragmentBase { Bundle rargs = new Bundle(); rargs.putLong("id", id); rargs.putString("sender", getArguments().getString("sender")); + rargs.putString("recipient", getArguments().getString("recipient")); rargs.putString("subject", getArguments().getString("subject")); new SimpleTask() { @@ -399,7 +400,7 @@ public class FragmentRule extends FragmentBase { etSender.setText(jsender == null ? args.getString("sender") : jsender.getString("value")); cbSender.setChecked(jsender != null && jsender.getBoolean("regex")); - etRecipient.setText(jrecipient == null ? null : jrecipient.getString("value")); + etRecipient.setText(jrecipient == null ? args.getString("recipient") : jrecipient.getString("value")); cbRecipient.setChecked(jrecipient != null && jrecipient.getBoolean("regex")); etSubject.setText(jsubject == null ? args.getString("subject") : jsubject.getString("value"));