-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notifications with no content will now not be echoed by the app
- Loading branch information
1 parent
d718470
commit 12e3343
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/talmar/conveyor/notificationFilters/NullContentFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.talmar.conveyor.notificationFilters; | ||
|
||
import android.app.Notification; | ||
import android.service.notification.StatusBarNotification; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
/** | ||
* Filters out notifications that don't have a title and text. | ||
*/ | ||
public class NullContentFilter implements INotificationFilter { | ||
|
||
@Override | ||
public boolean shouldIgnoreNotification(@NonNull StatusBarNotification sbn) { | ||
Notification notification = sbn.getNotification(); | ||
|
||
return notification.extras.get(Notification.EXTRA_TITLE) == null | ||
&& notification.extras.get(Notification.EXTRA_TEXT) == null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters