diff options
| author | Po Lu <luangruo@yahoo.com> | 2023-09-25 13:01:44 +0800 |
|---|---|---|
| committer | Po Lu <luangruo@yahoo.com> | 2023-09-25 13:01:44 +0800 |
| commit | df5a9a78b51f2f42d2dbb010e811a239fc014732 (patch) | |
| tree | 748ced4f467648d2cdcb0e1845130bcac9bc6d7c /java/org/gnu/emacs/EmacsDesktopNotification.java | |
| parent | 947409d408ed763a9fc35f9f7df97fec28a16837 (diff) | |
Update Android port
* doc/lispref/os.texi (Desktop Notifications): Revise
documentation for android-notifications-notify to reflect
changes.
* java/org/gnu/emacs/EmacsDesktopNotification.java (display1):
Convert notification importance to a legacy priority between
Android 7.1 and 4.1.
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap): Remove
immutable bitmap constructor, as the underlying Android API
functions are erroneously implemented.
* src/android.c (android_init_emacs_pixmap): Cease searching for
deleted constructor.
(android_create_pixmap_from_bitmap_data): Create a pixmap, then
fill it with the contents of the bitmap, in lieu of employing
the aforementioned constructor.
* src/androidselect.c (Fandroid_notifications_notify): Revise
doc string.
Diffstat (limited to 'java/org/gnu/emacs/EmacsDesktopNotification.java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsDesktopNotification.java | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/java/org/gnu/emacs/EmacsDesktopNotification.java b/java/org/gnu/emacs/EmacsDesktopNotification.java index 121d8f481a2..56ed984d497 100644 --- a/java/org/gnu/emacs/EmacsDesktopNotification.java +++ b/java/org/gnu/emacs/EmacsDesktopNotification.java @@ -96,6 +96,7 @@ public final class EmacsDesktopNotification RemoteViews contentView; Intent intent; PendingIntent pending; + int priority; tem = context.getSystemService (Context.NOTIFICATION_SERVICE); manager = (NotificationManager) tem; @@ -116,11 +117,37 @@ public final class EmacsDesktopNotification .build ()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) - notification = (new Notification.Builder (context) - .setContentTitle (title) - .setContentText (content) - .setSmallIcon (icon) - .build ()); + { + /* Android 7.1 and earlier don't segregate notifications into + distinct categories, but permit an importance to be + assigned to each individual notification. */ + + switch (importance) + { + case 2: /* IMPORTANCE_LOW */ + default: + priority = Notification.PRIORITY_LOW; + break; + + case 3: /* IMPORTANCE_DEFAULT */ + priority = Notification.PRIORITY_DEFAULT; + break; + + case 4: /* IMPORTANCE_HIGH */ + priority = Notification.PRIORITY_HIGH; + break; + } + + notification = (new Notification.Builder (context) + .setContentTitle (title) + .setContentText (content) + .setSmallIcon (icon) + .setPriority (priority) + .build ()); + + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) + notification.priority = priority; + } else { notification = new Notification (); |
