From bbce690d4fad7047e529ed384e656da6d7ee1dd9 Mon Sep 17 00:00:00 2001 From: Dan Pasanen Date: Wed, 30 Aug 2017 11:08:31 -0500 Subject: [PATCH] NotificationService: add button to mark conversation as read --- .../eu/siacs/conversations/services/NotificationService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 5b9e94808..dc18b74ca 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -388,6 +388,7 @@ public class NotificationService { modifyForTextOnly(mBuilder, mUnreadBuilder, messages); } RemoteInput remoteInput = new RemoteInput.Builder("text_reply").setLabel(UIHelper.getMessageHint(mXmppConnectionService, conversation)).build(); + NotificationCompat.Action markReadAction = new NotificationCompat.Action.Builder(R.drawable.ic_send_text_offline, "Mark As Read", createReadPendingIntent(conversation)).build(); NotificationCompat.Action replyAction = new NotificationCompat.Action.Builder(R.drawable.ic_send_text_offline, "Reply", createReplyIntent(conversation, false)).addRemoteInput(remoteInput).build(); NotificationCompat.Action wearReplyAction = new NotificationCompat.Action.Builder(R.drawable.ic_wear_reply, "Reply", createReplyIntent(conversation, true)).addRemoteInput(remoteInput).build(); mBuilder.extend(new NotificationCompat.WearableExtender().addAction(wearReplyAction)); @@ -395,6 +396,7 @@ public class NotificationService { mUnreadBuilder.setReadPendingIntent(createReadPendingIntent(conversation)); mBuilder.extend(new NotificationCompat.CarExtender().setUnreadConversation(mUnreadBuilder.build())); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + mBuilder.addAction(markReadAction); mBuilder.addAction(replyAction); } if ((message = getFirstDownloadableMessage(messages)) != null) {