You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
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:
@@ -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;}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class NotificationManager {
|
||||
actionName = notification.intent.intent.getAction();
|
||||
className = notification.intent.intent.getComponent() != null ? notification.intent.intent.getComponent().getClassName() : null;
|
||||
}
|
||||
nativeShowNotification(builder, id, notification.title, notification.text, notification.iconPath, intentType, actionName, className);
|
||||
nativeShowNotification(builder, id, notification.title, notification.text, notification.iconPath, notification.ongoing, intentType, actionName, className);
|
||||
}
|
||||
|
||||
public void notify(int id, Notification notification) {
|
||||
@@ -55,5 +55,5 @@ public class NotificationManager {
|
||||
|
||||
protected native long nativeInitBuilder();
|
||||
protected native void nativeAddAction(long builder, String title, int intentType, String action, String className);
|
||||
protected native void nativeShowNotification(long builder, int id, String title, String text, String iconPath, int intentType, String action, String className);
|
||||
protected native void nativeShowNotification(long builder, int id, String title, String text, String iconPath, boolean ongoing, int intentType, String action, String className);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user