diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 21d0907d91..48bb84c1fb 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2061,6 +2061,7 @@ class Core { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean biometrics = prefs.getBoolean("biometrics", false); + boolean biometric_notify = prefs.getBoolean("biometrics_notify", false); boolean flags = prefs.getBoolean("flags", true); boolean notify_preview = prefs.getBoolean("notify_preview", true); boolean notify_trash = (prefs.getBoolean("notify_trash", true) || !pro); @@ -2113,7 +2114,7 @@ class Core { .setVisibility(NotificationCompat.VISIBILITY_PRIVATE) .setPublicVersion(pub); - if (!biometrics) { + if (!biometrics || biometric_notify) { DateFormat DTF = Helper.getDateTimeInstance(context, SimpleDateFormat.SHORT, SimpleDateFormat.SHORT); StringBuilder sb = new StringBuilder(); for (EntityMessage message : messages) { @@ -2211,7 +2212,7 @@ class Core { mbuilder.setDefaults(def); } - if (biometrics) + if (biometrics && !biometric_notify) mbuilder.setContentTitle(context.getResources().getQuantityString( R.plurals.title_notification_unseen, 1, 1)); else { @@ -2289,7 +2290,7 @@ class Core { mbuilder.addAction(actionSeen.build()); } - if (!biometrics) { + if (!biometrics || biometric_notify) { if (!TextUtils.isEmpty(message.subject)) mbuilder.setContentText(message.subject); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 1da2241949..57a18f02b8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -45,8 +45,9 @@ import androidx.constraintlayout.widget.Group; import androidx.preference.PreferenceManager; public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { - private Spinner spBiometricsTimeout; private SwitchCompat swDoubleBack; + private Spinner spBiometricsTimeout; + private SwitchCompat swBiometricsNotify; private SwitchCompat swEnglish; private SwitchCompat swWatchdog; private SwitchCompat swUpdates; @@ -62,7 +63,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private Group grpDebug; private final static String[] RESET_OPTIONS = new String[]{ - "biometrics_timeout", "double_back", "english", "watchdog", "updates", "crash_reports", "debug" + "double_back", "biometrics_timeout", "biometrics_notify", "english", "watchdog", "updates", "crash_reports", "debug" }; private final static String[] RESET_QUESTIONS = new String[]{ @@ -79,8 +80,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc // Get controls - spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout); swDoubleBack = view.findViewById(R.id.swDoubleBack); + spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout); + swBiometricsNotify = view.findViewById(R.id.swBiometricsNotify); swEnglish = view.findViewById(R.id.swEnglish); swWatchdog = view.findViewById(R.id.swWatchdog); swUpdates = view.findViewById(R.id.swUpdates); @@ -101,6 +103,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + swDoubleBack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("double_back", checked).apply(); + } + }); + spBiometricsTimeout.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView adapterView, View view, int position, long id) { @@ -114,10 +123,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - swDoubleBack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + swBiometricsNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("double_back", checked).apply(); + prefs.edit().putBoolean("biometrics_notify", checked).apply(); } }); @@ -254,6 +263,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private void setOptions() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + swDoubleBack.setChecked(prefs.getBoolean("double_back", true)); + int biometrics_timeout = prefs.getInt("biometrics_timeout", 2); int[] biometricTimeoutValues = getResources().getIntArray(R.array.biometricsTimeoutValues); for (int pos = 0; pos < biometricTimeoutValues.length; pos++) @@ -262,7 +273,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc break; } - swDoubleBack.setChecked(prefs.getBoolean("double_back", true)); + swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", false)); + swEnglish.setChecked(prefs.getBoolean("english", false)); swWatchdog.setChecked(prefs.getBoolean("watchdog", true)); swUpdates.setChecked(prefs.getBoolean("updates", true)); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index ab7f5c14f8..d682fc6ad3 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -19,17 +19,29 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + + app:layout_constraintTop_toBottomOf="@id/swDoubleBack" /> At most three actions will be shown Tap on the channel name \'Notifications\' to set the default notification sound, etc - Manage folder subscriptions - Synchronize subscribed folders only - Biometric authentication timeout Double \'back\' to exit + Biometric authentication timeout + Show notification content when using biometric authentication Force English language Periodically check if FairEmail is still active Check for updates @@ -302,6 +301,8 @@ Some providers don\'t support this properly, which, for example, may result in all messages being synchronized This will transfer extra data and consume extra battery power, especially if a lot of messages are stored on the device Disabling this will reduce data and battery usage somewhat, but will disable updating the list of folders too + Manage folder subscriptions + Synchronize subscribed folders only This will check if DNS MX records exist This will slow down synchronizing messages