use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class DeviceNotifications method addMarkAsReadAction.
private void addMarkAsReadAction(Builder builder, NotificationContent content, int notificationId) {
int icon = getMarkAsReadActionIcon();
String title = context.getString(R.string.notification_action_mark_as_read);
MessageReference messageReference = content.messageReference;
PendingIntent action = actionCreator.createMarkMessageAsReadPendingIntent(messageReference, notificationId);
builder.addAction(icon, title, action);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class DeviceNotifications method createInboxStyleSummaryNotification.
private NotificationCompat.Builder createInboxStyleSummaryNotification(Account account, NotificationData notificationData, int unreadMessageCount) {
NotificationHolder latestNotification = notificationData.getHolderForLatestNotification();
int newMessagesCount = notificationData.getNewMessagesCount();
String accountName = controller.getAccountName(account);
String title = context.getResources().getQuantityString(R.plurals.notification_new_messages_title, newMessagesCount, newMessagesCount);
String summary = (notificationData.hasSummaryOverflowMessages()) ? context.getString(R.string.notification_additional_messages, notificationData.getSummaryOverflowMessagesCount(), accountName) : accountName;
String groupKey = NotificationGroupKeys.getGroupKey(account);
NotificationCompat.Builder builder = createAndInitializeNotificationBuilder(account).setNumber(unreadMessageCount).setTicker(latestNotification.content.summary).setGroup(groupKey).setGroupSummary(true).setContentTitle(title).setSubText(accountName);
NotificationCompat.InboxStyle style = createInboxStyle(builder).setBigContentTitle(title).setSummaryText(summary);
for (NotificationContent content : notificationData.getContentForSummaryNotification()) {
style.addLine(content.summary);
}
builder.setStyle(style);
addMarkAllAsReadAction(builder, notificationData);
addDeleteAllAction(builder, notificationData);
wearNotifications.addSummaryActions(builder, notificationData);
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
List<MessageReference> messageReferences = notificationData.getAllMessageReferences();
PendingIntent contentIntent = actionCreator.createViewMessagesPendingIntent(account, messageReferences, notificationId);
builder.setContentIntent(contentIntent);
return builder;
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class DeviceNotifications method addDeleteAllAction.
private void addDeleteAllAction(Builder builder, NotificationData notificationData) {
if (K9.getNotificationQuickDeleteBehaviour() != NotificationQuickDelete.ALWAYS) {
return;
}
int icon = getDeleteActionIcon();
String title = context.getString(R.string.notification_action_delete);
Account account = notificationData.getAccount();
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences();
PendingIntent action = actionCreator.createDeleteAllPendingIntent(account, messageReferences, notificationId);
builder.addAction(icon, title, action);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class DeviceNotifications method addMarkAllAsReadAction.
private void addMarkAllAsReadAction(Builder builder, NotificationData notificationData) {
int icon = getMarkAsReadActionIcon();
String title = context.getString(R.string.notification_action_mark_as_read);
Account account = notificationData.getAccount();
ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences();
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
PendingIntent markAllAsReadPendingIntent = actionCreator.createMarkAllAsReadPendingIntent(account, messageReferences, notificationId);
builder.addAction(icon, title, markAllAsReadPendingIntent);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class NotificationActionCreator method buildMessageViewBackStack.
private TaskStackBuilder buildMessageViewBackStack(MessageReference message) {
Account account = Preferences.getPreferences(context).getAccount(message.getAccountUuid());
String folderName = message.getFolderName();
TaskStackBuilder stack = buildMessageListBackStack(account, folderName);
Intent intent = MessageList.actionDisplayMessageIntent(context, message);
stack.addNextIntent(intent);
return stack;
}
Aggregations