diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 64502c7921..6b52a391a7 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -3102,6 +3102,8 @@ class Core { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean notify_summary = prefs.getBoolean("notify_summary", false); + boolean notify_preview = prefs.getBoolean("notify_preview", true); + boolean notify_preview_only = prefs.getBoolean("notify_preview_only", false); boolean wearable_preview = prefs.getBoolean("wearable_preview", false); boolean biometrics = prefs.getBoolean("biometrics", false); boolean biometric_notify = prefs.getBoolean("biometrics_notify", false); @@ -3130,6 +3132,9 @@ class Core { } } + if (notify_preview && notify_preview_only && !message.content) + continue; + long group = (pro && message.accountNotify ? message.account : 0); if (!message.folderUnified) group = -message.folder; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index f2d977359e..31088d8a55 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -77,6 +77,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared private SwitchCompat swNotifyClear; private SwitchCompat swNotifyPreview; private SwitchCompat swNotifyPreviewAll; + private SwitchCompat swNotifyPreviewOnly; private SwitchCompat swWearablePreview; private SwitchCompat swBiometricsNotify; private SwitchCompat swAlertOnce; @@ -93,7 +94,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared "light", "sound", "badge", "unseen_ignored", "notify_known", "notify_summary", "notify_remove", "notify_clear", - "notify_preview", "notify_preview_all", "wearable_preview", + "notify_preview", "notify_preview_all", "notify_preview_only", "wearable_preview", "biometrics_notify", "alert_once" }; @@ -136,6 +137,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared swNotifyClear = view.findViewById(R.id.swNotifyClear); swNotifyPreview = view.findViewById(R.id.swNotifyPreview); swNotifyPreviewAll = view.findViewById(R.id.swNotifyPreviewAll); + swNotifyPreviewOnly = view.findViewById(R.id.swNotifyPreviewOnly); swWearablePreview = view.findViewById(R.id.swWearablePreview); swBiometricsNotify = view.findViewById(R.id.swBiometricsNotify); swAlertOnce = view.findViewById(R.id.swAlertOnce); @@ -351,6 +353,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared } }); + swNotifyPreviewOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("notify_preview_only", checked).apply(); + } + }); + swWearablePreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -454,6 +463,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false)); swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true)); swNotifyPreviewAll.setChecked(prefs.getBoolean("notify_preview_all", false)); + swNotifyPreviewOnly.setChecked(prefs.getBoolean("notify_preview_only", false)); swWearablePreview.setChecked(prefs.getBoolean("wearable_preview", false)); swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", false)); swAlertOnce.setChecked(!prefs.getBoolean("alert_once", true)); @@ -477,6 +487,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared cbNotifyActionSnooze.setEnabled(pro && !summary); swNotifyPreview.setEnabled(!summary); swNotifyPreviewAll.setEnabled(!summary && swNotifyPreview.isChecked()); + swNotifyPreviewOnly.setEnabled(!summary && swNotifyPreview.isChecked()); swWearablePreview.setEnabled(!summary && swNotifyPreview.isChecked()); swBiometricsNotify.setEnabled(!summary); } diff --git a/app/src/main/res/layout/fragment_options_notifications.xml b/app/src/main/res/layout/fragment_options_notifications.xml index 19200466c8..6c1cb6ed04 100644 --- a/app/src/main/res/layout/fragment_options_notifications.xml +++ b/app/src/main/res/layout/fragment_options_notifications.xml @@ -446,6 +446,29 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swNotifyPreviewAll" /> + + + + Show summary notification only Show message preview in notifications Preview all text + Show notifications with a preview text only Notification actions Trash Spam @@ -540,6 +541,7 @@ To set the default sound, etc To disable the permanent notification For wearables that can show the full text (up to 5,000 characters) + This delays showing of notifications until the message text has been downloaded Notifications are only sent to a wearable after the message text has been downloaded The target folder can be configured in the account settings This Android version does not support notification grouping