use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class LockScreenNotification method createPublicNotificationWithSenderList.
private Notification createPublicNotificationWithSenderList(NotificationData notificationData) {
Builder builder = createPublicNotification(notificationData);
int newMessages = notificationData.getNewMessagesCount();
if (newMessages == 1) {
NotificationHolder holder = notificationData.getHolderForLatestNotification();
builder.setContentText(holder.content.sender);
} else {
List<NotificationContent> contents = notificationData.getContentForSummaryNotification();
String senderList = createCommaSeparatedListOfSenders(contents);
builder.setContentText(senderList);
}
return builder.build();
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class LockScreenNotification method createPublicNotificationWithNewMessagesCount.
private Notification createPublicNotificationWithNewMessagesCount(NotificationData notificationData) {
Builder builder = createPublicNotification(notificationData);
Account account = notificationData.getAccount();
String accountName = controller.getAccountName(account);
builder.setContentText(accountName);
return builder.build();
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class WearNotifications method buildStackedNotification.
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();
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class SyncNotifications method showFetchingMailNotification.
public void showFetchingMailNotification(Account account, Folder folder) {
String accountName = account.getDescription();
String folderName = folder.getName();
Context context = controller.getContext();
String tickerText = context.getString(R.string.notification_bg_sync_ticker, accountName, folderName);
String title = context.getString(R.string.notification_bg_sync_title);
//TODO: Use format string from resources
String text = accountName + context.getString(R.string.notification_bg_title_separator) + folderName;
int notificationId = NotificationIds.getFetchingMailNotificationId(account);
PendingIntent showMessageListPendingIntent = actionBuilder.createViewFolderPendingIntent(account, folderName, notificationId);
NotificationCompat.Builder builder = controller.createNotificationBuilder().setSmallIcon(R.drawable.ic_notify_check_mail).setWhen(System.currentTimeMillis()).setOngoing(true).setTicker(tickerText).setContentTitle(title).setContentText(text).setContentIntent(showMessageListPendingIntent).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).setCategory(NotificationCompat.CATEGORY_SERVICE);
if (NOTIFICATION_LED_WHILE_SYNCING) {
controller.configureNotification(builder, null, null, account.getNotificationSetting().getLedColor(), NOTIFICATION_LED_BLINK_FAST, true);
}
getNotificationManager().notify(notificationId, builder.build());
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class BaseNotificationsTest method testCreateAndInitializeNotificationBuilder.
@Test
public void testCreateAndInitializeNotificationBuilder() throws Exception {
Account account = createFakeAccount();
Builder builder = notifications.createAndInitializeNotificationBuilder(account);
verify(builder).setSmallIcon(R.drawable.notification_icon_new_mail);
verify(builder).setColor(ACCOUNT_COLOR);
verify(builder).setAutoCancel(true);
}
Aggregations