From bdc63699f8361247eed7e77e8e7938d56a49ad9d Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 4 Sep 2017 21:06:22 +0200 Subject: NotificationService: add button to mark conversation as read --- src/main/java/de/pixart/messenger/services/NotificationService.java | 2 ++ src/main/res/values/strings.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index 73d536d1a..5e86ebb91 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -399,6 +399,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, mXmppConnectionService.getResources().getString(R.string.mark_as_read), createReadPendingIntent(conversation)).build(); NotificationCompat.Action replyAction = new NotificationCompat.Action.Builder(R.drawable.ic_send_text_offline, mXmppConnectionService.getResources().getString(R.string.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)); @@ -406,6 +407,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) { diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 047db6e0a..8121ea382 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -784,4 +784,5 @@ Network is unreachable Certificate does not contain a Jabber ID There are no usable keys available for this contact.\\nMake sure you have mutual presence subscription. + Mark as read -- cgit v1.2.3