@Test public void testAddNewMailNotification() throws Exception { int notificationIndex = 0; LocalMessage message = createLocalMessage(); NotificationContent content = createNotificationContent(); NotificationHolder holder = createNotificationHolder(content, notificationIndex); addToNotificationContentCreator(message, content); whenAddingContentReturn(content, AddNotificationResult.newNotification(holder)); Notification wearNotification = createNotification(); Notification summaryNotification = createNotification(); addToWearNotifications(holder, wearNotification); addToDeviceNotifications(summaryNotification); newMailNotifications.addNewMailNotification(account, message, 42); int wearNotificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex); int summaryNotificationId = NotificationIds.getNewMailSummaryNotificationId(account); verify(notificationManager).notify(wearNotificationId, wearNotification); verify(notificationManager).notify(summaryNotificationId, summaryNotification); }
public void addNewMailNotification(Account account, LocalMessage message, int unreadMessageCount) { NotificationContent content = contentCreator.createFromMessage(account, message); synchronized (lock) { NotificationData notificationData = getOrCreateNotificationData(account, unreadMessageCount); AddNotificationResult result = notificationData.addNotificationContent(content); if (result.shouldCancelNotification()) { int notificationId = result.getNotificationId(); cancelNotification(notificationId); } createStackedNotification(account, result.getNotificationHolder()); createSummaryNotification(account, notificationData, false); } }
NewMailNotifications { public void addNewMailNotification(Account account, LocalMessage message, int unreadMessageCount) { NotificationContent content = contentCreator.createFromMessage(account, message); synchronized (lock) { NotificationData notificationData = getOrCreateNotificationData(account, unreadMessageCount); AddNotificationResult result = notificationData.addNotificationContent(content); if (result.shouldCancelNotification()) { int notificationId = result.getNotificationId(); cancelNotification(notificationId); } createStackedNotification(account, result.getNotificationHolder()); createSummaryNotification(account, notificationData, false); } } }
NewMailNotifications { public void addNewMailNotification(Account account, LocalMessage message, int unreadMessageCount) { NotificationContent content = contentCreator.createFromMessage(account, message); synchronized (lock) { NotificationData notificationData = getOrCreateNotificationData(account, unreadMessageCount); AddNotificationResult result = notificationData.addNotificationContent(content); if (result.shouldCancelNotification()) { int notificationId = result.getNotificationId(); cancelNotification(notificationId); } createStackedNotification(account, result.getNotificationHolder()); createSummaryNotification(account, notificationData, false); } } NewMailNotifications(NotificationController controller, NotificationContentCreator contentCreator,
            DeviceNotifications deviceNotifications, WearNotifications wearNotifications); }
NewMailNotifications { public void addNewMailNotification(Account account, LocalMessage message, int unreadMessageCount) { NotificationContent content = contentCreator.createFromMessage(account, message); synchronized (lock) { NotificationData notificationData = getOrCreateNotificationData(account, unreadMessageCount); AddNotificationResult result = notificationData.addNotificationContent(content); if (result.shouldCancelNotification()) { int notificationId = result.getNotificationId(); cancelNotification(notificationId); } createStackedNotification(account, result.getNotificationHolder()); createSummaryNotification(account, notificationData, false); } } NewMailNotifications(NotificationController controller, NotificationContentCreator contentCreator,
            DeviceNotifications deviceNotifications, WearNotifications wearNotifications); static NewMailNotifications newInstance(NotificationController controller,
            NotificationActionCreator actionCreator); void addNewMailNotification(Account account, LocalMessage message, int unreadMessageCount); void removeNewMailNotification(Account account, MessageReference messageReference); void clearNewMailNotifications(Account account); }
NewMailNotifications { public void addNewMailNotification(Account account, LocalMessage message, int unreadMessageCount) { NotificationContent content = contentCreator.createFromMessage(account, message); synchronized (lock) { NotificationData notificationData = getOrCreateNotificationData(account, unreadMessageCount); AddNotificationResult result = notificationData.addNotificationContent(content); if (result.shouldCancelNotification()) { int notificationId = result.getNotificationId(); cancelNotification(notificationId); } createStackedNotification(account, result.getNotificationHolder()); createSummaryNotification(account, notificationData, false); } } NewMailNotifications(NotificationController controller, NotificationContentCreator contentCreator,
            DeviceNotifications deviceNotifications, WearNotifications wearNotifications); static NewMailNotifications newInstance(NotificationController controller,
            NotificationActionCreator actionCreator); void addNewMailNotification(Account account, LocalMessage message, int unreadMessageCount); void removeNewMailNotification(Account account, MessageReference messageReference); void clearNewMailNotifications(Account account);  }