Added advanced option to disable grouping of notifications

pull/212/head
M66B 2 years ago
parent e7fffb2c5f
commit b6597e675c

@ -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)

@ -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));

@ -526,6 +526,18 @@
app:layout_constraintTop_toBottomOf="@id/ibBadge"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyGrouping"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_notify_grouping"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swUnseenIgnored"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyPrivate"
android:layout_width="0dp"
@ -535,7 +547,7 @@
android:text="@string/title_advanced_notify_private"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swUnseenIgnored"
app:layout_constraintTop_toBottomOf="@id/swNotifyGrouping"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -671,6 +671,7 @@
<string name="title_advanced_badge">Show launcher icon with number of new messages</string>
<string name="title_advanced_unseen_ignored">Let the number of new messages match the number of notifications</string>
<string name="title_advanced_notify_grouping">Group notifications</string>
<string name="title_advanced_notify_private">Keep notifications private when the device is locked</string>
<string name="title_advanced_notify_background">Show notifications when in the background only</string>
<string name="title_advanced_notify_known">Show notifications for contacts only</string>

Loading…
Cancel
Save