diff --git a/CHANGELOG.md b/CHANGELOG.md
index 736cf57664..3dd4e082a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@
### [Juratyrant](https://en.wikipedia.org/wiki/Juratyrant)
+### Next version
+
+* Added option to suppress new message notifications when calling
+* Small improvements and minor bug fixes
+* Updated translations
+
### 1.1915 - 2022-06-14
* Fixed initializing option values
diff --git a/app/src/main/assets/CHANGELOG.md b/app/src/main/assets/CHANGELOG.md
index 736cf57664..3dd4e082a2 100644
--- a/app/src/main/assets/CHANGELOG.md
+++ b/app/src/main/assets/CHANGELOG.md
@@ -4,6 +4,12 @@
### [Juratyrant](https://en.wikipedia.org/wiki/Juratyrant)
+### Next version
+
+* Added option to suppress new message notifications when calling
+* Small improvements and minor bug fixes
+* Updated translations
+
### 1.1915 - 2022-06-14
* Fixed initializing option values
diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java
index 639ae482db..39d9433275 100644
--- a/app/src/main/java/eu/faircode/email/Core.java
+++ b/app/src/main/java/eu/faircode/email/Core.java
@@ -4942,6 +4942,7 @@ class Core {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean badge = prefs.getBoolean("badge", true);
boolean notify_background_only = prefs.getBoolean("notify_background_only", false);
+ boolean notify_suppress_in_call = prefs.getBoolean("notify_suppress_in_call", false);
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);
@@ -4996,6 +4997,14 @@ class Core {
continue;
}
+ if (notify_suppress_in_call && message.notifying == 0 &&
+ MediaPlayerHelper.isInCall(context)) {
+ Log.i("Notify call=" + message.id);
+ if (!message.ui_ignored)
+ db.message().setMessageUiIgnored(message.id, true);
+ 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 b91104814f..c671855829 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
@@ -91,6 +91,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swUnseenIgnored;
private SwitchCompat swNotifyBackgroundOnly;
private SwitchCompat swNotifyKnownOnly;
+ private SwitchCompat swNotifySuppressInCall;
private TextView tvNotifyKnownPro;
private SwitchCompat swNotifySummary;
private SwitchCompat swNotifyRemove;
@@ -121,7 +122,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
"notify_flag", "notify_seen", "notify_hide", "notify_snooze",
"light", "sound", "notify_screen_on",
"badge", "unseen_ignored",
- "notify_background_only", "notify_known", "notify_summary", "notify_remove", "notify_clear",
+ "notify_background_only", "notify_known", "notify_suppress_in_call", "notify_summary", "notify_remove", "notify_clear",
"notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "notify_transliterate",
"wearable_preview",
"notify_messaging",
@@ -172,6 +173,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored);
swNotifyBackgroundOnly = view.findViewById(R.id.swNotifyBackgroundOnly);
swNotifyKnownOnly = view.findViewById(R.id.swNotifyKnownOnly);
+ swNotifySuppressInCall = view.findViewById(R.id.swNotifySuppressInCall);
tvNotifyKnownPro = view.findViewById(R.id.tvNotifyKnownPro);
swNotifySummary = view.findViewById(R.id.swNotifySummary);
swNotifyRemove = view.findViewById(R.id.swNotifyRemove);
@@ -467,6 +469,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
+ swNotifySuppressInCall.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("notify_suppress_in_call", checked).apply();
+ }
+ });
+
swNotifySummary.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -675,6 +684,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
swNotifyBackgroundOnly.setChecked(prefs.getBoolean("notify_background_only", false));
swNotifyKnownOnly.setChecked(prefs.getBoolean("notify_known", false));
+ swNotifySuppressInCall.setChecked(prefs.getBoolean("notify_suppress_in_call", false));
swNotifySummary.setChecked(prefs.getBoolean("notify_summary", false));
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false));
diff --git a/app/src/main/res/layout/fragment_options_notifications.xml b/app/src/main/res/layout/fragment_options_notifications.xml
index 393d8a09fe..f1a64dbd3a 100644
--- a/app/src/main/res/layout/fragment_options_notifications.xml
+++ b/app/src/main/res/layout/fragment_options_notifications.xml
@@ -538,6 +538,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyKnownOnly" />
+
+
Let the number of new messages match the number of notifications
Show notifications when in the background only
Show notifications for contacts only
+ Suppress notifications when calling
Show summary notification only
Show message preview in notifications
Preview all text
diff --git a/metadata/en-US/changelogs/1915.txt b/metadata/en-US/changelogs/1915.txt
index 736cf57664..3dd4e082a2 100644
--- a/metadata/en-US/changelogs/1915.txt
+++ b/metadata/en-US/changelogs/1915.txt
@@ -4,6 +4,12 @@
### [Juratyrant](https://en.wikipedia.org/wiki/Juratyrant)
+### Next version
+
+* Added option to suppress new message notifications when calling
+* Small improvements and minor bug fixes
+* Updated translations
+
### 1.1915 - 2022-06-14
* Fixed initializing option values