mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 18:45:49 +01:00
Add option to ignore low priority notifications
This commit is contained in:
parent
5920b26aab
commit
5637a2bc45
@ -911,10 +911,11 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
|
||||||
// Check for screen on when posting the notification; for removal, the screen
|
// Check for screen on when posting the notification; for removal, the screen
|
||||||
// has to be on (obviously)
|
// has to be on (obviously)
|
||||||
if(!remove) {
|
if(!remove) {
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
|
||||||
if (!prefs.getBoolean("notifications_generic_whenscreenon", false)) {
|
if (!prefs.getBoolean("notifications_generic_whenscreenon", false)) {
|
||||||
PowerManager powermanager = (PowerManager) getSystemService(POWER_SERVICE);
|
PowerManager powermanager = (PowerManager) getSystemService(POWER_SERVICE);
|
||||||
if (powermanager != null && powermanager.isScreenOn()) {
|
if (powermanager != null && powermanager.isScreenOn()) {
|
||||||
@ -924,6 +925,13 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sbn.getNotification().priority < Notification.PRIORITY_DEFAULT) {
|
||||||
|
if (prefs.getBoolean("notifications_ignore_low_priority", true)) {
|
||||||
|
LOG.info("Ignoring low priority notification");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldIgnoreOngoing(sbn)){
|
if (shouldIgnoreOngoing(sbn)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -197,6 +197,8 @@
|
|||||||
<string name="pref_title_notifications_generic">Generic notification support</string>
|
<string name="pref_title_notifications_generic">Generic notification support</string>
|
||||||
<string name="pref_title_notifications_generic_settings">Android notification settings</string>
|
<string name="pref_title_notifications_generic_settings">Android notification settings</string>
|
||||||
<string name="pref_title_whenscreenon">…also when screen is on</string>
|
<string name="pref_title_whenscreenon">…also when screen is on</string>
|
||||||
|
<string name="pref_title_notifications_ignore_low_priority">Ignore low priority notifications</string>
|
||||||
|
<string name="pref_summary_notifications_ignore_low_priority">Do not send low and minimum priority notifications to the watch</string>
|
||||||
<string name="pref_title_notification_filter">Do Not Disturb</string>
|
<string name="pref_title_notification_filter">Do Not Disturb</string>
|
||||||
<string name="pref_summary_notification_filter">Block all notifications when Do Not Disturb is enabled on the phone</string>
|
<string name="pref_summary_notification_filter">Block all notifications when Do Not Disturb is enabled on the phone</string>
|
||||||
<string name="pref_header_notification_application_settings">Per application settings</string>
|
<string name="pref_header_notification_application_settings">Per application settings</string>
|
||||||
|
@ -17,6 +17,13 @@
|
|||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:title="@string/pref_title_whenscreenon" />
|
android:title="@string/pref_title_whenscreenon" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="notifications_ignore_low_priority"
|
||||||
|
android:layout="@layout/preference_checkbox"
|
||||||
|
android:title="@string/pref_title_notifications_ignore_low_priority"
|
||||||
|
android:summary="@string/pref_summary_notifications_ignore_low_priority" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="minimize_priority"
|
android:key="minimize_priority"
|
||||||
|
Loading…
Reference in New Issue
Block a user