From aaa65a457e59fa72deda56abbc828bd9c7a153f9 Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Sun, 6 Jan 2013 12:16:54 +0100 Subject: [PATCH] In the new-style notification, directly go to message if new message count is 1. This matches what is displayed in the notification itself. --- src/com/fsck/k9/controller/MessagingController.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 1da0e8748..00a6e84c2 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -4701,8 +4701,18 @@ public class MessagingController implements Runnable { } Intent targetIntent; + boolean treatAsSingleMessageNotification; - if (unreadCount == 1) { + if (platformSupportsExtendedNotifications()) { + // in the new-style notifications, we focus on the new messages, not the unread ones + treatAsSingleMessageNotification = newMessages == 1; + } else { + // in the old-style notifications, we focus on unread messages, as we don't have a + // good way to express the new message count + treatAsSingleMessageNotification = unreadCount == 1; + } + + if (treatAsSingleMessageNotification) { targetIntent = MessageView.actionHandleNotificationIntent( context, message.makeMessageReference()); } else { @@ -4717,6 +4727,7 @@ public class MessagingController implements Runnable { targetIntent = FolderList.actionHandleNotification(context, account, initialFolder); } + PendingIntent pi = PendingIntent.getActivity(context, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pi);