aboutsummaryrefslogtreecommitdiffstats
path: root/java/org
diff options
context:
space:
mode:
authorPo Lu2023-09-25 13:01:44 +0800
committerPo Lu2023-09-25 13:01:44 +0800
commitdf5a9a78b51f2f42d2dbb010e811a239fc014732 (patch)
tree748ced4f467648d2cdcb0e1845130bcac9bc6d7c /java/org
parent947409d408ed763a9fc35f9f7df97fec28a16837 (diff)
downloademacs-df5a9a78b51f2f42d2dbb010e811a239fc014732.tar.gz
emacs-df5a9a78b51f2f42d2dbb010e811a239fc014732.zip
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')
-rw-r--r--java/org/gnu/emacs/EmacsDesktopNotification.java37
-rw-r--r--java/org/gnu/emacs/EmacsPixmap.java33
2 files changed, 32 insertions, 38 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
96 RemoteViews contentView; 96 RemoteViews contentView;
97 Intent intent; 97 Intent intent;
98 PendingIntent pending; 98 PendingIntent pending;
99 int priority;
99 100
100 tem = context.getSystemService (Context.NOTIFICATION_SERVICE); 101 tem = context.getSystemService (Context.NOTIFICATION_SERVICE);
101 manager = (NotificationManager) tem; 102 manager = (NotificationManager) tem;
@@ -116,11 +117,37 @@ public final class EmacsDesktopNotification
116 .build ()); 117 .build ());
117 } 118 }
118 else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) 119 else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
119 notification = (new Notification.Builder (context) 120 {
120 .setContentTitle (title) 121 /* Android 7.1 and earlier don't segregate notifications into
121 .setContentText (content) 122 distinct categories, but permit an importance to be
122 .setSmallIcon (icon) 123 assigned to each individual notification. */
123 .build ()); 124
125 switch (importance)
126 {
127 case 2: /* IMPORTANCE_LOW */
128 default:
129 priority = Notification.PRIORITY_LOW;
130 break;
131
132 case 3: /* IMPORTANCE_DEFAULT */
133 priority = Notification.PRIORITY_DEFAULT;
134 break;
135
136 case 4: /* IMPORTANCE_HIGH */
137 priority = Notification.PRIORITY_HIGH;
138 break;
139 }
140
141 notification = (new Notification.Builder (context)
142 .setContentTitle (title)
143 .setContentText (content)
144 .setSmallIcon (icon)
145 .setPriority (priority)
146 .build ());
147
148 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN)
149 notification.priority = priority;
150 }
124 else 151 else
125 { 152 {
126 notification = new Notification (); 153 notification = new Notification ();
diff --git a/java/org/gnu/emacs/EmacsPixmap.java b/java/org/gnu/emacs/EmacsPixmap.java
index e02699ecba7..fa6e61c15a5 100644
--- a/java/org/gnu/emacs/EmacsPixmap.java
+++ b/java/org/gnu/emacs/EmacsPixmap.java
@@ -51,39 +51,6 @@ public final class EmacsPixmap extends EmacsHandleObject
51 private long gcClipRectID; 51 private long gcClipRectID;
52 52
53 public 53 public
54 EmacsPixmap (short handle, int colors[], int width,
55 int height, int depth)
56 {
57 super (handle);
58
59 if (depth != 1 && depth != 24)
60 throw new IllegalArgumentException ("Invalid depth specified"
61 + " for pixmap: " + depth);
62
63 switch (depth)
64 {
65 case 1:
66 bitmap = Bitmap.createBitmap (colors, width, height,
67 Bitmap.Config.ALPHA_8);
68 break;
69
70 case 24:
71 bitmap = Bitmap.createBitmap (colors, width, height,
72 Bitmap.Config.ARGB_8888);
73 bitmap.setHasAlpha (false);
74 break;
75 }
76
77 this.width = width;
78 this.height = height;
79 this.depth = depth;
80
81 /* The immutable bitmap constructor is only leveraged to create
82 small fringe bitmaps. */
83 this.needCollect = false;
84 }
85
86 public
87 EmacsPixmap (short handle, int width, int height, int depth) 54 EmacsPixmap (short handle, int width, int height, int depth)
88 { 55 {
89 super (handle); 56 super (handle);