use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class NotificationContentCreatorTest method createFakeLocalMessage.
private LocalMessage createFakeLocalMessage(MessageReference messageReference) throws Exception {
LocalMessage message = mock(LocalMessage.class);
when(message.makeMessageReference()).thenReturn(messageReference);
when(message.getPreviewType()).thenReturn(PreviewType.TEXT);
when(message.getPreview()).thenReturn(PREVIEW);
when(message.getSubject()).thenReturn(SUBJECT);
when(message.getFrom()).thenReturn(new Address[] { new Address(SENDER_ADDRESS, SENDER_NAME) });
when(message.getRecipients(RecipientType.TO)).thenReturn(new Address[] { new Address(RECIPIENT_ADDRESS, RECIPIENT_NAME) });
return message;
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class NotificationDataTest method testGetAllMessageReferences.
@Test
public void testGetAllMessageReferences() throws Exception {
MessageReference messageReference0 = createMessageReference("1");
MessageReference messageReference1 = createMessageReference("2");
MessageReference messageReference2 = createMessageReference("3");
MessageReference messageReference3 = createMessageReference("4");
MessageReference messageReference4 = createMessageReference("5");
MessageReference messageReference5 = createMessageReference("6");
MessageReference messageReference6 = createMessageReference("7");
MessageReference messageReference7 = createMessageReference("8");
MessageReference messageReference8 = createMessageReference("9");
notificationData.addNotificationContent(createNotificationContent(messageReference8));
notificationData.addNotificationContent(createNotificationContent(messageReference7));
notificationData.addNotificationContent(createNotificationContent(messageReference6));
notificationData.addNotificationContent(createNotificationContent(messageReference5));
notificationData.addNotificationContent(createNotificationContent(messageReference4));
notificationData.addNotificationContent(createNotificationContent(messageReference3));
notificationData.addNotificationContent(createNotificationContent(messageReference2));
notificationData.addNotificationContent(createNotificationContent(messageReference1));
notificationData.addNotificationContent(createNotificationContent(messageReference0));
List<MessageReference> messageReferences = notificationData.getAllMessageReferences();
assertEquals(9, messageReferences.size());
assertEquals(messageReference0, messageReferences.get(0));
assertEquals(messageReference1, messageReferences.get(1));
assertEquals(messageReference2, messageReferences.get(2));
assertEquals(messageReference3, messageReferences.get(3));
assertEquals(messageReference4, messageReferences.get(4));
assertEquals(messageReference5, messageReferences.get(5));
assertEquals(messageReference6, messageReferences.get(6));
assertEquals(messageReference7, messageReferences.get(7));
assertEquals(messageReference8, messageReferences.get(8));
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class WearNotificationsTest method testAddSummaryActions.
@Test
public void testAddSummaryActions() throws Exception {
disableOptionalSummaryActions();
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
ArrayList<MessageReference> messageReferences = createMessageReferenceList();
NotificationData notificationData = createNotificationData(messageReferences);
PendingIntent markAllAsReadPendingIntent = createFakePendingIntent(1);
when(actionCreator.getMarkAllAsReadPendingIntent(account, messageReferences, notificationId)).thenReturn(markAllAsReadPendingIntent);
wearNotifications.addSummaryActions(builder, notificationData);
verifyExtendWasOnlyCalledOnce();
verifyAddAction(R.drawable.ic_action_mark_as_read_dark, "Mark All Read", markAllAsReadPendingIntent);
verifyNumberOfActions(1);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class WearNotifications method addArchiveAction.
private void addArchiveAction(WearableExtender wearableExtender, NotificationHolder holder) {
int icon = R.drawable.ic_action_archive_dark;
String title = context.getString(R.string.notification_action_archive);
MessageReference messageReference = holder.content.messageReference;
int notificationId = holder.notificationId;
PendingIntent action = actionCreator.createArchiveMessagePendingIntent(messageReference, notificationId);
NotificationCompat.Action archiveAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(archiveAction);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class WearNotifications method addDeleteAction.
private void addDeleteAction(WearableExtender wearableExtender, NotificationHolder holder) {
int icon = R.drawable.ic_action_delete_dark;
String title = context.getString(R.string.notification_action_delete);
MessageReference messageReference = holder.content.messageReference;
int notificationId = holder.notificationId;
PendingIntent action = actionCreator.createDeleteMessagePendingIntent(messageReference, notificationId);
NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(deleteAction);
}
Aggregations