aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/services/NotificationService.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/services/NotificationService.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/services/NotificationService.java b/src/eu/siacs/conversations/services/NotificationService.java
index 831ce51ff..1bc494b74 100644
--- a/src/eu/siacs/conversations/services/NotificationService.java
+++ b/src/eu/siacs/conversations/services/NotificationService.java
@@ -120,10 +120,11 @@ public class NotificationService {
+ mXmppConnectionService
.getString(R.string.unread_conversations));
StringBuilder names = new StringBuilder();
+ Conversation conversation = null;
for (ArrayList<Message> messages : notifications.values()) {
if (messages.size() > 0) {
- String name = messages.get(0).getConversation()
- .getName();
+ conversation = messages.get(0).getConversation();
+ String name = conversation.getName();
style.addLine(Html.fromHtml("<b>"
+ name
+ "</b> "
@@ -142,6 +143,10 @@ public class NotificationService {
.getString(R.string.unread_conversations));
mBuilder.setContentText(names.toString());
mBuilder.setStyle(style);
+ if (conversation!=null) {
+ mBuilder.setContentIntent(createContentIntent(conversation
+ .getUuid()));
+ }
}
if (notify) {
if (vibrate) {
@@ -153,6 +158,7 @@ public class NotificationService {
mBuilder.setSound(Uri.parse(ringtone));
}
}
+ mBuilder.setDeleteIntent(createDeleteIntent());
mBuilder.setLights(0xffffffff, 2000, 4000);
Notification notification = mBuilder.build();
mNotificationManager.notify(NOTIFICATION_ID, notification);
@@ -177,6 +183,12 @@ public class NotificationService {
PendingIntent.FLAG_UPDATE_CURRENT);
return resultPendingIntent;
}
+
+ private PendingIntent createDeleteIntent() {
+ Intent intent = new Intent(mXmppConnectionService, XmppConnectionService.class);
+ intent.setAction("clear_notification");
+ return PendingIntent.getService(mXmppConnectionService, 0, intent, 0);
+ }
public static boolean wasHighlightedOrPrivate(Message message) {
String nick = message.getConversation().getMucOptions().getActualNick();