mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Extract bigtext from notifications
This commit is contained in:
parent
35635a0b0b
commit
db0c48cc6b
@ -304,17 +304,27 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
np.set("title", notification.extras.getString(Notification.EXTRA_TITLE));
|
||||
}
|
||||
|
||||
if (conversation.second != null) {
|
||||
np.set("text", conversation.second);
|
||||
} else {
|
||||
np.set("text", notification.extras.getString(Notification.EXTRA_TEXT));
|
||||
}
|
||||
np.set("text", extractText(notification, conversation));
|
||||
}
|
||||
}
|
||||
|
||||
device.sendPacket(np);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
private String extractText(Notification notification, Pair<String, String> conversation) {
|
||||
|
||||
if (conversation.second != null) {
|
||||
return conversation.second;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && notification.extras.containsKey(Notification.EXTRA_BIG_TEXT)) {
|
||||
return extractStringFromExtra(notification.extras, Notification.EXTRA_BIG_TEXT);
|
||||
}
|
||||
|
||||
return notification.extras.getString(Notification.EXTRA_TEXT);
|
||||
}
|
||||
|
||||
private Pair<String, String> extractConversation(Notification notification) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
||||
return new Pair<>(null, null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user