@Test public void configureLockScreenNotification_SENDERS_withMultipleMessages() throws Exception { QMail.setLockScreenNotificationVisibility(LockScreenNotificationVisibility.SENDERS); NotificationContent content1 = createNotificationContent("alice@example.com"); NotificationContent content2 = createNotificationContent("Bob <bob@example.com>"); NotificationContent content3 = createNotificationContent("\"Peter Lustig\" <peter@example.com>"); when(notificationData.getNewMessagesCount()).thenReturn(NEW_MESSAGE_COUNT); when(notificationData.getUnreadMessageCount()).thenReturn(UNREAD_MESSAGE_COUNT); when(notificationData.getContentForSummaryNotification()).thenReturn( Arrays.asList(content1, content2, content3)); lockScreenNotification.configureLockScreenNotification(builder, notificationData); verify(publicBuilder).setSmallIcon(R.drawable.notification_icon_new_mail); verify(publicBuilder).setNumber(UNREAD_MESSAGE_COUNT); verify(publicBuilder).setContentTitle(NEW_MESSAGE_COUNT + " new messages"); verify(publicBuilder).setContentText( "alice@example.com, Bob <bob@example.com>, \"Peter Lustig\" <peter@example.com>"); verify(builder).setPublicVersion(publicBuilder.build()); }
public void configureLockScreenNotification(Builder builder, NotificationData notificationData) { if (!NotificationController.platformSupportsLockScreenNotifications()) { return; } switch (QMail.getLockScreenNotificationVisibility()) { case NOTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_SECRET); break; } case APP_NAME: { builder.setVisibility(NotificationCompat.VISIBILITY_PRIVATE); break; } case EVERYTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); break; } case SENDERS: { Notification publicNotification = createPublicNotificationWithSenderList(notificationData); builder.setPublicVersion(publicNotification); break; } case MESSAGE_COUNT: { Notification publicNotification = createPublicNotificationWithNewMessagesCount(notificationData); builder.setPublicVersion(publicNotification); break; } } }
LockScreenNotification { public void configureLockScreenNotification(Builder builder, NotificationData notificationData) { if (!NotificationController.platformSupportsLockScreenNotifications()) { return; } switch (QMail.getLockScreenNotificationVisibility()) { case NOTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_SECRET); break; } case APP_NAME: { builder.setVisibility(NotificationCompat.VISIBILITY_PRIVATE); break; } case EVERYTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); break; } case SENDERS: { Notification publicNotification = createPublicNotificationWithSenderList(notificationData); builder.setPublicVersion(publicNotification); break; } case MESSAGE_COUNT: { Notification publicNotification = createPublicNotificationWithNewMessagesCount(notificationData); builder.setPublicVersion(publicNotification); break; } } } }
LockScreenNotification { public void configureLockScreenNotification(Builder builder, NotificationData notificationData) { if (!NotificationController.platformSupportsLockScreenNotifications()) { return; } switch (QMail.getLockScreenNotificationVisibility()) { case NOTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_SECRET); break; } case APP_NAME: { builder.setVisibility(NotificationCompat.VISIBILITY_PRIVATE); break; } case EVERYTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); break; } case SENDERS: { Notification publicNotification = createPublicNotificationWithSenderList(notificationData); builder.setPublicVersion(publicNotification); break; } case MESSAGE_COUNT: { Notification publicNotification = createPublicNotificationWithNewMessagesCount(notificationData); builder.setPublicVersion(publicNotification); break; } } } LockScreenNotification(NotificationController controller); }
LockScreenNotification { public void configureLockScreenNotification(Builder builder, NotificationData notificationData) { if (!NotificationController.platformSupportsLockScreenNotifications()) { return; } switch (QMail.getLockScreenNotificationVisibility()) { case NOTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_SECRET); break; } case APP_NAME: { builder.setVisibility(NotificationCompat.VISIBILITY_PRIVATE); break; } case EVERYTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); break; } case SENDERS: { Notification publicNotification = createPublicNotificationWithSenderList(notificationData); builder.setPublicVersion(publicNotification); break; } case MESSAGE_COUNT: { Notification publicNotification = createPublicNotificationWithNewMessagesCount(notificationData); builder.setPublicVersion(publicNotification); break; } } } LockScreenNotification(NotificationController controller); static LockScreenNotification newInstance(NotificationController controller); void configureLockScreenNotification(Builder builder, NotificationData notificationData); }
LockScreenNotification { public void configureLockScreenNotification(Builder builder, NotificationData notificationData) { if (!NotificationController.platformSupportsLockScreenNotifications()) { return; } switch (QMail.getLockScreenNotificationVisibility()) { case NOTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_SECRET); break; } case APP_NAME: { builder.setVisibility(NotificationCompat.VISIBILITY_PRIVATE); break; } case EVERYTHING: { builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); break; } case SENDERS: { Notification publicNotification = createPublicNotificationWithSenderList(notificationData); builder.setPublicVersion(publicNotification); break; } case MESSAGE_COUNT: { Notification publicNotification = createPublicNotificationWithNewMessagesCount(notificationData); builder.setPublicVersion(publicNotification); break; } } } LockScreenNotification(NotificationController controller); static LockScreenNotification newInstance(NotificationController controller); void configureLockScreenNotification(Builder builder, NotificationData notificationData);  }