Differential D10905 Diff 28488 src/org/kde/kdeconnect/Plugins/ReceiveNotificationsPlugin/ReceiveNotificationsPlugin.java
Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Plugins/ReceiveNotificationsPlugin/ReceiveNotificationsPlugin.java
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 87 | if (np.hasPayload()) { | |||
---|---|---|---|---|---|
88 | int width = 64; // default icon dimensions | 88 | int width = 64; // default icon dimensions | ||
89 | int height = 64; | 89 | int height = 64; | ||
90 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | 90 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | ||
91 | width = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width); | 91 | width = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width); | ||
92 | height = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height); | 92 | height = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height); | ||
93 | } | 93 | } | ||
94 | final InputStream input = np.getPayload(); | 94 | final InputStream input = np.getPayload(); | ||
95 | largeIcon = BitmapFactory.decodeStream(np.getPayload()); | 95 | largeIcon = BitmapFactory.decodeStream(np.getPayload()); | ||
96 | try { input.close(); } catch (Exception e) { } | 96 | try { | ||
97 | input.close(); | ||||
98 | } catch (Exception e) { | ||||
99 | } | ||||
97 | if (largeIcon != null) { | 100 | if (largeIcon != null) { | ||
98 | //Log.i("NotificationsPlugin", "hasPayload: size=" + largeIcon.getWidth() + "/" + largeIcon.getHeight() + " opti=" + width + "/" + height); | 101 | //Log.i("NotificationsPlugin", "hasPayload: size=" + largeIcon.getWidth() + "/" + largeIcon.getHeight() + " opti=" + width + "/" + height); | ||
99 | if (largeIcon.getWidth() > width || largeIcon.getHeight() > height) { | 102 | if (largeIcon.getWidth() > width || largeIcon.getHeight() > height) { | ||
100 | // older API levels don't scale notification icons automatically, therefore: | 103 | // older API levels don't scale notification icons automatically, therefore: | ||
101 | largeIcon = Bitmap.createScaledBitmap(largeIcon, width, height, false); | 104 | largeIcon = Bitmap.createScaledBitmap(largeIcon, width, height, false); | ||
102 | } | 105 | } | ||
103 | } | 106 | } | ||
104 | } | 107 | } | ||
Show All 31 Lines |