From c99ebc751a98984d1403acae9caa209c94d975e3 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 9 Jan 2019 14:51:18 +0000 Subject: [PATCH] Added section to collapse addresses section by default --- FAQ.md | 4 ++-- .../main/java/eu/faircode/email/ActivityBase.java | 2 +- .../java/eu/faircode/email/FragmentMessages.java | 5 ++++- .../java/eu/faircode/email/FragmentOptions.java | 10 ++++++++++ app/src/main/res/layout/fragment_options.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + 6 files changed, 31 insertions(+), 5 deletions(-) diff --git a/FAQ.md b/FAQ.md index 5175c79621..d6fd104d00 100644 --- a/FAQ.md +++ b/FAQ.md @@ -52,7 +52,6 @@ Since FairEmail is meant to be privacy friendly, the following will not be added * Open links without confirmation * Show original message without confirmation -* Hide addresses by default: addresses play an important role in determining if a message is authentic * Direct file/folder access: for security/privacy reasons (other) apps should use the [Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider) Confirmation or hiding the addresses section is just one tap, which is just a small price for better privacy. @@ -200,7 +199,7 @@ you'll need to enable insecure connections in the account and/or identity settin **(5) How can I customize the message view?** -In the advanced settings you can enable or disable: +In the display section of the advanced settings you can enable or disable: * *unified inbox*: to disable the unified inbox and to list the folders selected for the unified inbox instead * *conversation threading*: to disable conversation threading and to show individual messages instead @@ -208,6 +207,7 @@ In the advanced settings you can enable or disable: * *show contact photos*: to hide contact photos * *show identicons*: to show generated contact avatars * *show message preview*: to show two lines of the message text +* *Show address details by default*: to collapse the addresses section by default If the list of addresses is long, you can collapse the addresses section with the *less* icon at the top of the addresses section. diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index c01ade516d..ae677eca4c 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -41,7 +41,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc private boolean contacts; private static String[] restart = new String[]{ - "unified", "threading", "compact", "avatars", "identicons", "preview", + "unified", "threading", "compact", "avatars", "identicons", "preview", "addresses", "pull", "actionbar", "autoclose", "confirm", "debug" }; diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 49e6b6fc3d..c28db7855a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -117,6 +117,7 @@ public class FragmentMessages extends FragmentEx { private boolean pull; private boolean actionbar; private boolean autoclose; + private boolean addresses; private long primary = -1; private boolean outbox = false; @@ -178,7 +179,7 @@ public class FragmentMessages extends FragmentEx { threading = prefs.getBoolean("threading", true); actionbar = prefs.getBoolean("actionbar", true); autoclose = prefs.getBoolean("autoclose", true); - + addresses = prefs.getBoolean("addresses", true); } @Override @@ -350,6 +351,8 @@ public class FragmentMessages extends FragmentEx { public boolean getValue(String name, long id) { if (values.containsKey(name)) return values.get(name).contains(id); + else if ("addresses".equals(name)) + return !addresses; return false; } diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index 6c30bc7da6..36f48b972e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -64,6 +64,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS private SwitchCompat swAvatars; private SwitchCompat swIdenticons; private SwitchCompat swPreview; + private SwitchCompat swAddresses; private SwitchCompat swPull; private SwitchCompat swSwipe; @@ -104,6 +105,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS swAvatars = view.findViewById(R.id.swAvatars); swIdenticons = view.findViewById(R.id.swIdenticons); swPreview = view.findViewById(R.id.swPreview); + swAddresses = view.findViewById(R.id.swAddresses); swPull = view.findViewById(R.id.swPull); swSwipe = view.findViewById(R.id.swSwipe); @@ -254,6 +256,14 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS } }); + swAddresses.setChecked(prefs.getBoolean("addresses", true)); + swAddresses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("addresses", checked).apply(); + } + }); + swPull.setChecked(prefs.getBoolean("pull", true)); swPull.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override diff --git a/app/src/main/res/layout/fragment_options.xml b/app/src/main/res/layout/fragment_options.xml index 82f6485847..4a9f1a1e07 100644 --- a/app/src/main/res/layout/fragment_options.xml +++ b/app/src/main/res/layout/fragment_options.xml @@ -266,6 +266,18 @@ app:layout_constraintTop_toBottomOf="@id/swIdenticons" app:switchPadding="12dp" /> + + + app:layout_constraintTop_toBottomOf="@id/swAddresses" /> Show contact photos Show identicons Show message preview + Show address details by default Use notification light Select notification sound