@Test public void testBuildStackedNotification() throws Exception { disableOptionalActions(); int notificationIndex = 0; int notificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex); MessageReference messageReference = createMessageReference(1); NotificationContent content = createNotificationContent(messageReference); NotificationHolder holder = createNotificationHolder(notificationId, content); PendingIntent replyPendingIntent = createFakePendingIntent(1); when(actionCreator.createReplyPendingIntent(messageReference, notificationId)).thenReturn(replyPendingIntent); PendingIntent markAsReadPendingIntent = createFakePendingIntent(2); when(actionCreator.createMarkMessageAsReadPendingIntent(messageReference, notificationId)) .thenReturn(markAsReadPendingIntent); Notification result = wearNotifications.buildStackedNotification(account, holder); assertEquals(notification, result); verifyExtendWasOnlyCalledOnce(); verifyAddAction(R.drawable.ic_action_single_message_options_dark, "Reply", replyPendingIntent); verifyAddAction(R.drawable.ic_action_mark_as_read_dark, "Mark Read", markAsReadPendingIntent); verifyNumberOfActions(2); }
public Notification buildStackedNotification(Account account, NotificationHolder holder) { int notificationId = holder.notificationId; NotificationContent content = holder.content; NotificationCompat.Builder builder = createBigTextStyleNotification(account, holder, notificationId); PendingIntent deletePendingIntent = actionCreator.createDismissMessagePendingIntent( context, content.messageReference, holder.notificationId); builder.setDeleteIntent(deletePendingIntent); addActions(builder, account, holder); return builder.build(); }
WearNotifications extends BaseNotifications { public Notification buildStackedNotification(Account account, NotificationHolder holder) { int notificationId = holder.notificationId; NotificationContent content = holder.content; NotificationCompat.Builder builder = createBigTextStyleNotification(account, holder, notificationId); PendingIntent deletePendingIntent = actionCreator.createDismissMessagePendingIntent( context, content.messageReference, holder.notificationId); builder.setDeleteIntent(deletePendingIntent); addActions(builder, account, holder); return builder.build(); } }
WearNotifications extends BaseNotifications { public Notification buildStackedNotification(Account account, NotificationHolder holder) { int notificationId = holder.notificationId; NotificationContent content = holder.content; NotificationCompat.Builder builder = createBigTextStyleNotification(account, holder, notificationId); PendingIntent deletePendingIntent = actionCreator.createDismissMessagePendingIntent( context, content.messageReference, holder.notificationId); builder.setDeleteIntent(deletePendingIntent); addActions(builder, account, holder); return builder.build(); } WearNotifications(NotificationController controller, NotificationActionCreator actionCreator); }
WearNotifications extends BaseNotifications { public Notification buildStackedNotification(Account account, NotificationHolder holder) { int notificationId = holder.notificationId; NotificationContent content = holder.content; NotificationCompat.Builder builder = createBigTextStyleNotification(account, holder, notificationId); PendingIntent deletePendingIntent = actionCreator.createDismissMessagePendingIntent( context, content.messageReference, holder.notificationId); builder.setDeleteIntent(deletePendingIntent); addActions(builder, account, holder); return builder.build(); } WearNotifications(NotificationController controller, NotificationActionCreator actionCreator); Notification buildStackedNotification(Account account, NotificationHolder holder); void addSummaryActions(Builder builder, NotificationData notificationData); }
WearNotifications extends BaseNotifications { public Notification buildStackedNotification(Account account, NotificationHolder holder) { int notificationId = holder.notificationId; NotificationContent content = holder.content; NotificationCompat.Builder builder = createBigTextStyleNotification(account, holder, notificationId); PendingIntent deletePendingIntent = actionCreator.createDismissMessagePendingIntent( context, content.messageReference, holder.notificationId); builder.setDeleteIntent(deletePendingIntent); addActions(builder, account, holder); return builder.build(); } WearNotifications(NotificationController controller, NotificationActionCreator actionCreator); Notification buildStackedNotification(Account account, NotificationHolder holder); void addSummaryActions(Builder builder, NotificationData notificationData);  }