mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-08 15:35:24 +02: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) {
|
||||
Bundle extras = notification.extras;
|
||||
|
||||
//dumpExtras(extras);
|
||||
|
||||
CharSequence title = extras.getCharSequence(Notification.EXTRA_TITLE);
|
||||
if (title != null) {
|
||||
notificationSpec.title = title.toString();
|
||||
}
|
||||
if (extras.containsKey(Notification.EXTRA_TEXT)) {
|
||||
CharSequence contentCS = extras.getCharSequence(Notification.EXTRA_TEXT);
|
||||
if (contentCS != null) {
|
||||
notificationSpec.body = contentCS.toString();
|
||||
}
|
||||
|
||||
CharSequence contentCS = null;
|
||||
if (extras.containsKey(Notification.EXTRA_BIG_TEXT)) {
|
||||
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() {
|
||||
@ -412,4 +420,14 @@ public class NotificationListener extends NotificationListenerService {
|
||||
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…
Reference in New Issue
Block a user