diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-24 20:52:43 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-24 20:52:43 +0100 |
commit | 67c82b49d55eba8e99a4accaff14a6cc37f6b1cd (patch) | |
tree | 1aaf5e752c6c7287802b20272c22052845da5e3c /src | |
parent | 0a6eb6630612cda0ce6a9ec896d81281efd9631f (diff) |
added avatar to 'me' in notifications
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/NotificationService.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index 095abdee1..270005dc9 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -658,9 +658,13 @@ public class NotificationService { private void modifyForTextOnly(final Builder builder, final UnreadConversation.Builder uBuilder, final ArrayList<Message> messages) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - final Person me = new Person.Builder().setName(mXmppConnectionService.getString(R.string.me)).build(); - NotificationCompat.MessagingStyle messagingStyle = new NotificationCompat.MessagingStyle(me); final Conversation conversation = (Conversation) messages.get(0).getConversation(); + final Person.Builder meBuilder = new Person.Builder().setName(mXmppConnectionService.getString(R.string.me)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + meBuilder.setIcon(IconCompat.createWithBitmap(mXmppConnectionService.getAvatarService().get(conversation.getAccount(), AvatarService.getSystemUiAvatarSize(mXmppConnectionService)))); + } + final Person me = meBuilder.build(); + NotificationCompat.MessagingStyle messagingStyle = new NotificationCompat.MessagingStyle(me); final boolean multiple = conversation.getMode() == Conversation.MODE_MULTI; if (multiple) { messagingStyle.setConversationTitle(conversation.getName()); |