From 32ece5079f81b39cc1d5d9ac8ec0d1ff29c3796d Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 5 Feb 2020 10:13:17 +0100 Subject: [PATCH] Added setting to enable removing of signatures --- .../java/eu/faircode/email/FragmentCompose.java | 4 ++-- .../java/eu/faircode/email/FragmentOptionsSend.java | 12 +++++++++++- app/src/main/res/layout/fragment_options_send.xml | 13 ++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 6c53609d1f..a534d0593a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -3065,8 +3065,8 @@ public class FragmentCompose extends FragmentBase { Document d = JsoupEx.parse(Helper.readText(ref.getFile(context))); // Remove signature separators - boolean usenet = prefs.getBoolean("usenet_signature", false); - if (usenet) + boolean remove_signatures = prefs.getBoolean("remove_signatures", false); + if (remove_signatures) d.body().filter(new NodeFilter() { private boolean remove = false; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java index 57bfc1e555..b5fa5cc101 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java @@ -53,6 +53,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc private SwitchCompat swPlainOnly; private SwitchCompat swSignatureEnd; private SwitchCompat swUsenetSignature; + private SwitchCompat swRemoveSignatures; private SwitchCompat swResizeImages; private SwitchCompat swResizeAttachments; private Spinner spAutoResize; @@ -65,7 +66,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc private final static String[] RESET_OPTIONS = new String[]{ "keyboard", "suggest_sent", "suggested_received", "prefix_once", "extended_reply", "quote_reply", "signature_end", - "plain_only", "usenet_signature", + "plain_only", "usenet_signature", "remove_signatures", "resize_images", "resize_attachments", "send_reminders", "receipt_default", "resize", "lookup_mx", "send_delayed" }; @@ -89,6 +90,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swPlainOnly = view.findViewById(R.id.swPlainOnly); swSignatureEnd = view.findViewById(R.id.swSignatureEnd); swUsenetSignature = view.findViewById(R.id.swUsenetSignature); + swRemoveSignatures = view.findViewById(R.id.swRemoveSignatures); swResizeImages = view.findViewById(R.id.swResizeImages); swResizeAttachments = view.findViewById(R.id.swResizeAttachments); spAutoResize = view.findViewById(R.id.spAutoResize); @@ -175,6 +177,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc } }); + swRemoveSignatures.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("remove_signatures", checked).apply(); + } + }); + swResizeImages.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -294,6 +303,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swPlainOnly.setChecked(prefs.getBoolean("plain_only", false)); swSignatureEnd.setChecked(prefs.getBoolean("signature_end", false)); swUsenetSignature.setChecked(prefs.getBoolean("usenet_signature", false)); + swRemoveSignatures.setChecked(prefs.getBoolean("remove_signatures", false)); swResizeImages.setChecked(prefs.getBoolean("resize_images", true)); swResizeAttachments.setChecked(prefs.getBoolean("resize_attachments", true)); diff --git a/app/src/main/res/layout/fragment_options_send.xml b/app/src/main/res/layout/fragment_options_send.xml index f73a39764b..220fe43356 100644 --- a/app/src/main/res/layout/fragment_options_send.xml +++ b/app/src/main/res/layout/fragment_options_send.xml @@ -164,6 +164,17 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swUsenetSignature" /> + + Add signature after quoted/forwarded message Send plain text only by default Usenet signature convention + Remove recognized signatures Automatically resize embedded images Automatically resize image attachments < %1$d pixels