diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
index 9f4d52d0bf..6e44d5cd2e 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
@@ -115,6 +115,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swNotifyRemove;
private SwitchCompat swNotifyClear;
private SwitchCompat swNotifySubtext;
+ private SwitchCompat swNotifySubject;
private SwitchCompat swNotifyPreview;
private SwitchCompat swNotifyPreviewAll;
private SwitchCompat swNotifyPreviewOnly;
@@ -150,7 +151,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
"badge", "unseen_ignored",
"notify_grouping", "notify_private", "notify_background_only", "notify_known", "notify_suppress_in_call", "notify_suppress_in_car",
"notify_remove", "notify_clear",
- "notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "notify_transliterate", "notify_ascii",
+ "notify_subtext", "notify_subject", "notify_preview", "notify_preview_all", "notify_preview_only", "notify_transliterate", "notify_ascii",
"wearable_preview",
"notify_messaging",
"biometrics_notify", "notify_open_folder", "background_service", "notify_rate_limit", "alert_once"
@@ -208,6 +209,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swNotifyRemove = view.findViewById(R.id.swNotifyRemove);
swNotifyClear = view.findViewById(R.id.swNotifyClear);
swNotifySubtext = view.findViewById(R.id.swNotifySubtext);
+ swNotifySubject = view.findViewById(R.id.swNotifySubject);
swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
swNotifyPreviewAll = view.findViewById(R.id.swNotifyPreviewAll);
swNotifyPreviewOnly = view.findViewById(R.id.swNotifyPreviewOnly);
@@ -658,6 +660,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
+ swNotifySubject.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("notify_subject", checked).apply();
+ }
+ });
+
swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -918,6 +927,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false));
swNotifySubtext.setChecked(prefs.getBoolean("notify_subtext", true));
+ swNotifySubject.setChecked(prefs.getBoolean("notify_subject", true));
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
swNotifyPreviewAll.setChecked(prefs.getBoolean("notify_preview_all", false));
swNotifyPreviewOnly.setChecked(prefs.getBoolean("notify_preview_only", false));
diff --git a/app/src/main/java/eu/faircode/email/NotificationHelper.java b/app/src/main/java/eu/faircode/email/NotificationHelper.java
index 19b9ce164b..fb58a1c3fb 100644
--- a/app/src/main/java/eu/faircode/email/NotificationHelper.java
+++ b/app/src/main/java/eu/faircode/email/NotificationHelper.java
@@ -707,6 +707,7 @@ class NotificationHelper {
boolean flags = prefs.getBoolean("flags", true);
boolean notify_messaging = prefs.getBoolean("notify_messaging", false);
boolean notify_subtext = prefs.getBoolean("notify_subtext", true);
+ boolean notify_subject = prefs.getBoolean("notify_subject", true);
boolean notify_preview = prefs.getBoolean("notify_preview", true);
boolean notify_preview_all = prefs.getBoolean("notify_preview_all", false);
boolean wearable_preview = prefs.getBoolean("wearable_preview", false);
@@ -873,7 +874,7 @@ class NotificationHelper {
Address[] afrom = messageFrom.get(message.id);
String from = MessageHelper.formatAddresses(afrom, email_format, false);
sb.append("").append(Html.escapeHtml(from)).append("");
- if (!TextUtils.isEmpty(message.subject))
+ if (!TextUtils.isEmpty(message.subject) && notify_subject)
sb.append(": ").append(Html.escapeHtml(message.subject));
sb.append(" ").append(Html.escapeHtml(DTF.format(message.received)));
sb.append("
");
@@ -997,7 +998,7 @@ class NotificationHelper {
NotificationCompat.MessagingStyle messagingStyle = new NotificationCompat.MessagingStyle(me.build());
- if (!TextUtils.isEmpty(message.subject))
+ if (!TextUtils.isEmpty(message.subject) && notify_subject)
messagingStyle.setConversationTitle(message.subject);
messagingStyle.addMessage(
@@ -1043,7 +1044,7 @@ class NotificationHelper {
// Wearables
StringBuilder sb = new StringBuilder();
- if (!TextUtils.isEmpty(message.subject))
+ if (!TextUtils.isEmpty(message.subject) && notify_subject)
sb.append(TextHelper.normalizeNotification(context, message.subject));
if (wearable_preview && !TextUtils.isEmpty(preview)) {
if (sb.length() > 0)
@@ -1062,7 +1063,7 @@ class NotificationHelper {
if (keyword.startsWith("!"))
sbm.append(Html.escapeHtml(keyword)).append(": ");
- if (!TextUtils.isEmpty(message.subject))
+ if (!TextUtils.isEmpty(message.subject) && notify_subject)
sbm.append("").append(Html.escapeHtml(message.subject)).append("").append("
");
if (!TextUtils.isEmpty(preview))
@@ -1071,14 +1072,14 @@ class NotificationHelper {
if (sbm.length() > 0) {
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()
.bigText(HtmlHelper.fromHtml(sbm.toString(), context));
- if (!TextUtils.isEmpty(message.subject))
+ if (!TextUtils.isEmpty(message.subject) && notify_subject)
bigText.setSummaryText(message.subject);
mbuilder.setStyle(bigText);
}
}
} else {
- if (!TextUtils.isEmpty(message.subject))
+ if (!TextUtils.isEmpty(message.subject) && notify_subject)
mbuilder.setContentText(TextHelper.normalizeNotification(context, message.subject));
}
diff --git a/app/src/main/res/layout/fragment_options_notifications.xml b/app/src/main/res/layout/fragment_options_notifications.xml
index 40cd8915e2..7176f3eae1 100644
--- a/app/src/main/res/layout/fragment_options_notifications.xml
+++ b/app/src/main/res/layout/fragment_options_notifications.xml
@@ -709,6 +709,18 @@
app:layout_constraintTop_toBottomOf="@id/swNotifyClear"
app:switchPadding="12dp" />
+
+
Delay notifications while on a call
Delay notifications while Android Auto is connected
Show summary notification only
+ Show subject in notifications
Show message preview in notifications
Preview all text
Show notifications with a preview text only