Add a 'mark as read' button to expanded notifications.

This commit is contained in:
Moxie Marlinspike
2013-05-30 12:39:56 -07:00
parent 8c1ca6c9e0
commit dda5bc8838
5 changed files with 99 additions and 4 deletions

View File

@@ -136,9 +136,9 @@ public class MessageNotifier {
NotificationState notificationState = constructNotificationState(context, masterSecret, cursor);
if (notificationState.hasMultipleThreads()) {
sendMultipleThreadNotification(context, notificationState, signal);
sendMultipleThreadNotification(context, masterSecret, notificationState, signal);
} else {
sendSingleThreadNotification(context, notificationState, signal);
sendSingleThreadNotification(context, masterSecret, notificationState, signal);
}
} finally {
if (cursor != null)
@@ -147,6 +147,7 @@ public class MessageNotifier {
}
private static void sendSingleThreadNotification(Context context,
MasterSecret masterSecret,
NotificationState notificationState,
boolean signal)
{
@@ -160,6 +161,11 @@ public class MessageNotifier {
builder.setContentText(notifications.get(0).getText());
builder.setContentIntent(notifications.get(0).getPendingIntent(context));
if (masterSecret != null) {
builder.addAction(R.drawable.check, context.getString(R.string.MessageNotifier_mark_as_read),
notificationState.getMarkAsReadIntent(context, masterSecret));
}
SpannableStringBuilder content = new SpannableStringBuilder();
for (NotificationItem item : notifications) {
@@ -180,6 +186,7 @@ public class MessageNotifier {
}
private static void sendMultipleThreadNotification(Context context,
MasterSecret masterSecret,
NotificationState notificationState,
boolean signal)
{
@@ -195,6 +202,11 @@ public class MessageNotifier {
notifications.get(0).getIndividualRecipientName()));
builder.setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, RoutingActivity.class), 0));
if (masterSecret != null) {
builder.addAction(R.drawable.check, context.getString(R.string.MessageNotifier_mark_all_as_read),
notificationState.getMarkAsReadIntent(context, masterSecret));
}
InboxStyle style = new InboxStyle();
for (NotificationItem item : notifications) {