Added section to collapse addresses section by default

This commit is contained in:
M66B 2019-01-09 14:51:18 +00:00
parent f893a11c8d
commit c99ebc751a
6 changed files with 31 additions and 5 deletions

4
FAQ.md
View File

@ -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
<a name="faq5"></a>
**(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.

View File

@ -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"
};

View File

@ -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;
}

View File

@ -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

View File

@ -266,6 +266,18 @@
app:layout_constraintTop_toBottomOf="@id/swIdenticons"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAddresses"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_addresses"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPreview"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvSectionBehavior"
android:layout_width="wrap_content"
@ -275,7 +287,7 @@
android:text="@string/title_advanced_section_behavior"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPreview" />
app:layout_constraintTop_toBottomOf="@id/swAddresses" />
<View
android:id="@+id/vSeparator4"

View File

@ -128,6 +128,7 @@
<string name="title_advanced_avatars">Show contact photos</string>
<string name="title_advanced_identicons">Show identicons</string>
<string name="title_advanced_preview">Show message preview</string>
<string name="title_advanced_addresses">Show address details by default</string>
<string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_sound">Select notification sound</string>