Added advanced option to disable grouping of notifications

This commit is contained in:
M66B
2023-02-10 18:21:08 +01:00
parent e7fffb2c5f
commit b6597e675c
4 changed files with 29 additions and 4 deletions

View File

@@ -5380,6 +5380,7 @@ class Core {
boolean pro = ActivityBilling.isPro(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean notify_grouping = prefs.getBoolean("notify_grouping", true);
boolean notify_private = prefs.getBoolean("notify_private", true);
boolean notify_newest_first = prefs.getBoolean("notify_newest_first", false);
MessageHelper.AddressFormat email_format = MessageHelper.getAddressFormat(context);
@@ -5437,7 +5438,8 @@ class Core {
}
// Summary notification
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N || notify_summary) {
if (notify_summary ||
(notify_grouping && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)) {
// Build pending intents
Intent content;
if (group < 0) {
@@ -5669,7 +5671,7 @@ class Core {
mbuilder.setStyle(messagingStyle);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
if (notify_grouping && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
mbuilder
.setGroup(Long.toString(group))
.setGroupSummary(false)

View File

@@ -97,6 +97,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swBadge;
private ImageButton ibBadge;
private SwitchCompat swUnseenIgnored;
private SwitchCompat swNotifyGrouping;
private SwitchCompat swNotifyPrivate;
private SwitchCompat swNotifyBackgroundOnly;
private SwitchCompat swNotifyKnownOnly;
@@ -135,7 +136,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_private", "notify_background_only", "notify_known", "notify_suppress_in_call", "notify_suppress_in_car",
"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",
"wearable_preview",
@@ -184,6 +185,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swBadge = view.findViewById(R.id.swBadge);
ibBadge = view.findViewById(R.id.ibBadge);
swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored);
swNotifyGrouping = view.findViewById(R.id.swNotifyGrouping);
swNotifyPrivate = view.findViewById(R.id.swNotifyPrivate);
swNotifyBackgroundOnly = view.findViewById(R.id.swNotifyBackgroundOnly);
swNotifyKnownOnly = view.findViewById(R.id.swNotifyKnownOnly);
@@ -541,6 +543,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
swNotifyGrouping.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("notify_grouping", checked).apply();
}
});
swNotifyPrivate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -811,6 +820,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swBadge.setChecked(prefs.getBoolean("badge", true));
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
swNotifyGrouping.setChecked(prefs.getBoolean("notify_grouping", true));
swNotifyPrivate.setChecked(prefs.getBoolean("notify_private", true));
swNotifyBackgroundOnly.setChecked(prefs.getBoolean("notify_background_only", false));
swNotifyKnownOnly.setChecked(prefs.getBoolean("notify_known", false));