@Test public void testShowSendingNotification() throws Exception { int notificationId = NotificationIds.getFetchingMailNotificationId(account); syncNotifications.showSendingNotification(account); verify(notificationManager).notify(eq(notificationId), any(Notification.class)); verify(builder).setSmallIcon(R.drawable.ic_notify_check_mail); verify(builder).setTicker("Sending mail: " + ACCOUNT_NAME); verify(builder).setContentTitle("Sending mail"); verify(builder).setContentText(ACCOUNT_NAME); verify(builder).setContentIntent(contentIntent); verify(builder).setVisibility(NotificationCompat.VISIBILITY_PUBLIC); }
public void showSendingNotification(Account account) { Context context = controller.getContext(); String accountName = controller.getAccountName(account); String title = context.getString(R.string.notification_bg_send_title); String tickerText = context.getString(R.string.notification_bg_send_ticker, accountName); int notificationId = NotificationIds.getFetchingMailNotificationId(account); String outboxFolderName = account.getOutboxFolderId(); PendingIntent showMessageListPendingIntent = actionBuilder.createViewFolderPendingIntent( account, outboxFolderName, notificationId); NotificationCompat.Builder builder = controller.createNotificationBuilder() .setSmallIcon(R.drawable.ic_notify_check_mail) .setWhen(System.currentTimeMillis()) .setOngoing(true) .setTicker(tickerText) .setContentTitle(title) .setContentText(accountName) .setContentIntent(showMessageListPendingIntent) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); if (NOTIFICATION_LED_WHILE_SYNCING) { controller.configureNotification(builder, null, null, account.getNotificationSetting().getLedColor(), NOTIFICATION_LED_BLINK_FAST, true); } getNotificationManager().notify(notificationId, builder.build()); }
SyncNotifications { public void showSendingNotification(Account account) { Context context = controller.getContext(); String accountName = controller.getAccountName(account); String title = context.getString(R.string.notification_bg_send_title); String tickerText = context.getString(R.string.notification_bg_send_ticker, accountName); int notificationId = NotificationIds.getFetchingMailNotificationId(account); String outboxFolderName = account.getOutboxFolderId(); PendingIntent showMessageListPendingIntent = actionBuilder.createViewFolderPendingIntent( account, outboxFolderName, notificationId); NotificationCompat.Builder builder = controller.createNotificationBuilder() .setSmallIcon(R.drawable.ic_notify_check_mail) .setWhen(System.currentTimeMillis()) .setOngoing(true) .setTicker(tickerText) .setContentTitle(title) .setContentText(accountName) .setContentIntent(showMessageListPendingIntent) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); if (NOTIFICATION_LED_WHILE_SYNCING) { controller.configureNotification(builder, null, null, account.getNotificationSetting().getLedColor(), NOTIFICATION_LED_BLINK_FAST, true); } getNotificationManager().notify(notificationId, builder.build()); } }
SyncNotifications { public void showSendingNotification(Account account) { Context context = controller.getContext(); String accountName = controller.getAccountName(account); String title = context.getString(R.string.notification_bg_send_title); String tickerText = context.getString(R.string.notification_bg_send_ticker, accountName); int notificationId = NotificationIds.getFetchingMailNotificationId(account); String outboxFolderName = account.getOutboxFolderId(); PendingIntent showMessageListPendingIntent = actionBuilder.createViewFolderPendingIntent( account, outboxFolderName, notificationId); NotificationCompat.Builder builder = controller.createNotificationBuilder() .setSmallIcon(R.drawable.ic_notify_check_mail) .setWhen(System.currentTimeMillis()) .setOngoing(true) .setTicker(tickerText) .setContentTitle(title) .setContentText(accountName) .setContentIntent(showMessageListPendingIntent) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); if (NOTIFICATION_LED_WHILE_SYNCING) { controller.configureNotification(builder, null, null, account.getNotificationSetting().getLedColor(), NOTIFICATION_LED_BLINK_FAST, true); } getNotificationManager().notify(notificationId, builder.build()); } SyncNotifications(NotificationController controller, NotificationActionCreator actionBuilder); }
SyncNotifications { public void showSendingNotification(Account account) { Context context = controller.getContext(); String accountName = controller.getAccountName(account); String title = context.getString(R.string.notification_bg_send_title); String tickerText = context.getString(R.string.notification_bg_send_ticker, accountName); int notificationId = NotificationIds.getFetchingMailNotificationId(account); String outboxFolderName = account.getOutboxFolderId(); PendingIntent showMessageListPendingIntent = actionBuilder.createViewFolderPendingIntent( account, outboxFolderName, notificationId); NotificationCompat.Builder builder = controller.createNotificationBuilder() .setSmallIcon(R.drawable.ic_notify_check_mail) .setWhen(System.currentTimeMillis()) .setOngoing(true) .setTicker(tickerText) .setContentTitle(title) .setContentText(accountName) .setContentIntent(showMessageListPendingIntent) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); if (NOTIFICATION_LED_WHILE_SYNCING) { controller.configureNotification(builder, null, null, account.getNotificationSetting().getLedColor(), NOTIFICATION_LED_BLINK_FAST, true); } getNotificationManager().notify(notificationId, builder.build()); } SyncNotifications(NotificationController controller, NotificationActionCreator actionBuilder); void showSendingNotification(Account account); void clearSendingNotification(Account account); void showFetchingMailNotification(Account account, Folder folder); void clearFetchingMailNotification(Account account); }
SyncNotifications { public void showSendingNotification(Account account) { Context context = controller.getContext(); String accountName = controller.getAccountName(account); String title = context.getString(R.string.notification_bg_send_title); String tickerText = context.getString(R.string.notification_bg_send_ticker, accountName); int notificationId = NotificationIds.getFetchingMailNotificationId(account); String outboxFolderName = account.getOutboxFolderId(); PendingIntent showMessageListPendingIntent = actionBuilder.createViewFolderPendingIntent( account, outboxFolderName, notificationId); NotificationCompat.Builder builder = controller.createNotificationBuilder() .setSmallIcon(R.drawable.ic_notify_check_mail) .setWhen(System.currentTimeMillis()) .setOngoing(true) .setTicker(tickerText) .setContentTitle(title) .setContentText(accountName) .setContentIntent(showMessageListPendingIntent) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); if (NOTIFICATION_LED_WHILE_SYNCING) { controller.configureNotification(builder, null, null, account.getNotificationSetting().getLedColor(), NOTIFICATION_LED_BLINK_FAST, true); } getNotificationManager().notify(notificationId, builder.build()); } SyncNotifications(NotificationController controller, NotificationActionCreator actionBuilder); void showSendingNotification(Account account); void clearSendingNotification(Account account); void showFetchingMailNotification(Account account, Folder folder); void clearFetchingMailNotification(Account account);  }