NotificationManager: delete ongoing and MediaStyle notifications on exit

The XDG Portal API doesn't have a concept of ongoing notifications.

MediaStyle notifications could be changed to MPRIS in the future.
This commit is contained in:
Julian Winkler
2024-03-18 15:41:44 +01:00
parent acb00a8beb
commit cdcc3411aa
5 changed files with 35 additions and 7 deletions

View File

@@ -52,6 +52,7 @@ public class Notification {
List<Action> actions = new ArrayList<Action>();
PendingIntent intent;
String iconPath;
boolean ongoing;
public String toString() {
return "Notification [" + title + ", " + text + ", " + actions + "]";
@@ -79,7 +80,10 @@ public class Notification {
public Builder setLights(int argb, int onMs, int offMs) {return this;}
public Builder setOngoing(boolean ongoing) {return this;}
public Builder setOngoing(boolean ongoing) {
notification.ongoing = ongoing;
return this;
}
public Builder setOnlyAlertOnce(boolean onlyAlertOnce) {return this;}
@@ -145,7 +149,12 @@ public class Notification {
return this;
}
public Builder setStyle(Style style) {return this;}
public Builder setStyle(Style style) {
if (style instanceof MediaStyle) {
notification.ongoing = true;
}
return this;
}
public Builder setExtras(Bundle extras) {return this;}