mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-27 18:17:33 +01:00
Extract EXTRA_BIG_TEXT instead of EXTRA_TEXT if available.
This makes K9 Mail usable with only using generic notifcations on Android >=5 (It shows the message preview now)
This commit is contained in:
parent
9dc9ad6ce4
commit
336ffd5bf7
@ -313,16 +313,24 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
|
|
||||||
private void dissectNotificationTo(Notification notification, NotificationSpec notificationSpec) {
|
private void dissectNotificationTo(Notification notification, NotificationSpec notificationSpec) {
|
||||||
Bundle extras = notification.extras;
|
Bundle extras = notification.extras;
|
||||||
|
|
||||||
|
//dumpExtras(extras);
|
||||||
|
|
||||||
CharSequence title = extras.getCharSequence(Notification.EXTRA_TITLE);
|
CharSequence title = extras.getCharSequence(Notification.EXTRA_TITLE);
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
notificationSpec.title = title.toString();
|
notificationSpec.title = title.toString();
|
||||||
}
|
}
|
||||||
if (extras.containsKey(Notification.EXTRA_TEXT)) {
|
|
||||||
CharSequence contentCS = extras.getCharSequence(Notification.EXTRA_TEXT);
|
CharSequence contentCS = null;
|
||||||
if (contentCS != null) {
|
if (extras.containsKey(Notification.EXTRA_BIG_TEXT)) {
|
||||||
notificationSpec.body = contentCS.toString();
|
contentCS = extras.getCharSequence(Notification.EXTRA_BIG_TEXT);
|
||||||
}
|
} else if (extras.containsKey(Notification.EXTRA_TEXT)) {
|
||||||
|
contentCS = extras.getCharSequence(Notification.EXTRA_TEXT);
|
||||||
}
|
}
|
||||||
|
if (contentCS != null) {
|
||||||
|
notificationSpec.body = contentCS.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isServiceRunning() {
|
private boolean isServiceRunning() {
|
||||||
@ -412,4 +420,14 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
public void onNotificationRemoved(StatusBarNotification sbn) {
|
public void onNotificationRemoved(StatusBarNotification sbn) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dumpExtras(Bundle bundle) {
|
||||||
|
for (String key : bundle.keySet()) {
|
||||||
|
Object value = bundle.get(key);
|
||||||
|
if (value == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LOG.debug(String.format("Notification extra: %s %s (%s)", key, value.toString(), value.getClass().getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user