diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 8ff56c4295..d2b6c0f996 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -4079,6 +4079,7 @@ class Core { boolean prefer_contact = prefs.getBoolean("prefer_contact", false); boolean flags = prefs.getBoolean("flags", true); boolean notify_messaging = prefs.getBoolean("notify_messaging", false); + boolean notify_subtext = prefs.getBoolean("notify_subtext", 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); @@ -4194,10 +4195,11 @@ class Core { builder.setColor(color); builder.setColorized(true); } - if (amessage.folderUnified) - builder.setSubText(amessage.accountName); - else - builder.setSubText(amessage.accountName + " · " + amessage.getFolderName(context)); + if (notify_subtext) + if (amessage.folderUnified && !EntityFolder.INBOX.equals(amessage.folderType)) + builder.setSubText(amessage.accountName); + else + builder.setSubText(amessage.accountName + " · " + amessage.getFolderName(context)); } Notification pub = builder.build(); @@ -4357,10 +4359,11 @@ class Core { Address[] afrom = messageFrom.get(message.id); String from = MessageHelper.formatAddresses(afrom, name_email, false); mbuilder.setContentTitle(from); - if (message.folderUnified && !EntityFolder.INBOX.equals(message.folderType)) - mbuilder.setSubText(message.accountName + " · " + message.getFolderName(context)); - else - mbuilder.setSubText(message.accountName); + if (notify_subtext) + if (message.folderUnified && !EntityFolder.INBOX.equals(message.folderType)) + mbuilder.setSubText(message.accountName + " · " + message.getFolderName(context)); + else + mbuilder.setSubText(message.accountName); DB db = DB.getInstance(context); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index c251983dd2..450edec1dd 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -87,6 +87,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared private SwitchCompat swNotifySummary; private SwitchCompat swNotifyRemove; private SwitchCompat swNotifyClear; + private SwitchCompat swNotifySubtext; private SwitchCompat swNotifyPreview; private SwitchCompat swNotifyPreviewAll; private SwitchCompat swNotifyPreviewOnly; @@ -111,7 +112,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared "light", "sound", "badge", "unseen_ignored", "notify_background_only", "notify_known", "notify_summary", "notify_remove", "notify_clear", - "notify_preview", "notify_preview_all", "notify_preview_only", "wearable_preview", + "notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "wearable_preview", "notify_messaging", "biometrics_notify", "alert_once" @@ -160,6 +161,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared swNotifySummary = view.findViewById(R.id.swNotifySummary); swNotifyRemove = view.findViewById(R.id.swNotifyRemove); swNotifyClear = view.findViewById(R.id.swNotifyClear); + swNotifySubtext = view.findViewById(R.id.swNotifySubtext); swNotifyPreview = view.findViewById(R.id.swNotifyPreview); swNotifyPreviewAll = view.findViewById(R.id.swNotifyPreviewAll); swNotifyPreviewOnly = view.findViewById(R.id.swNotifyPreviewOnly); @@ -408,6 +410,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared } }); + swNotifySubtext.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("notify_subtext", checked).apply(); + } + }); + swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -574,6 +583,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared swNotifySummary.setChecked(prefs.getBoolean("notify_summary", false)); swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true)); swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false)); + swNotifySubtext.setChecked(prefs.getBoolean("notify_subtext", 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/res/layout/fragment_options_notifications.xml b/app/src/main/res/layout/fragment_options_notifications.xml index 5bcc6c8cf8..df0a557300 100644 --- a/app/src/main/res/layout/fragment_options_notifications.xml +++ b/app/src/main/res/layout/fragment_options_notifications.xml @@ -531,13 +531,24 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="12dp" - android:checked="true" android:text="@string/title_advanced_notify_clear" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvNotifyRemoveHint" app:switchPadding="12dp" /> + + Snooze Remove new message notification on tapping on notification Remove new message notifications on viewing message list + Show account or folder name as subtext Only send notifications with a message preview to wearables Use Android \'messaging style\' notification format Show notification content when using biometric authentication