use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class WearNotifications method addWearActions.
private void addWearActions(Builder builder, Account account, NotificationHolder holder) {
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
addReplyAction(wearableExtender, holder);
addMarkAsReadAction(wearableExtender, holder);
if (isDeleteActionAvailableForWear()) {
addDeleteAction(wearableExtender, holder);
}
if (isArchiveActionAvailableForWear(account)) {
addArchiveAction(wearableExtender, holder);
}
if (isSpamActionAvailableForWear(account)) {
addMarkAsSpamAction(wearableExtender, holder);
}
builder.extend(wearableExtender);
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class SendFailedNotifications method showSendFailedNotification.
public void showSendFailedNotification(Account account, Exception exception) {
Context context = controller.getContext();
String title = context.getString(R.string.send_failure_subject);
String text = ExceptionHelper.getRootCauseMessage(exception);
int notificationId = NotificationIds.getSendFailedNotificationId(account);
PendingIntent folderListPendingIntent = actionBuilder.createViewFolderListPendingIntent(account, notificationId);
NotificationCompat.Builder builder = controller.createNotificationBuilder().setSmallIcon(getSendFailedNotificationIcon()).setWhen(System.currentTimeMillis()).setAutoCancel(true).setTicker(title).setContentTitle(title).setContentText(text).setContentIntent(folderListPendingIntent).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).setCategory(NotificationCompat.CATEGORY_ERROR);
controller.configureNotification(builder, null, null, NOTIFICATION_LED_FAILURE_COLOR, 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 SyncNotifications method showSendingNotification.
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.getOutboxFolderName();
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());
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class BaseNotifications method createBigTextStyleNotification.
protected NotificationCompat.Builder createBigTextStyleNotification(Account account, NotificationHolder holder, int notificationId) {
String accountName = controller.getAccountName(account);
NotificationContent content = holder.content;
String groupKey = NotificationGroupKeys.getGroupKey(account);
NotificationCompat.Builder builder = createAndInitializeNotificationBuilder(account).setTicker(content.summary).setGroup(groupKey).setContentTitle(content.sender).setContentText(content.subject).setSubText(accountName);
NotificationCompat.BigTextStyle style = createBigTextStyle(builder);
style.bigText(content.preview);
builder.setStyle(style);
PendingIntent contentIntent = actionCreator.createViewMessagePendingIntent(content.messageReference, notificationId);
builder.setContentIntent(contentIntent);
return builder;
}
use of android.support.v4.app.NotificationCompat.Builder in project k-9 by k9mail.
the class DeviceNotifications method createBigTextStyleSummaryNotification.
private NotificationCompat.Builder createBigTextStyleSummaryNotification(Account account, NotificationHolder holder) {
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
Builder builder = createBigTextStyleNotification(account, holder, notificationId).setGroupSummary(true);
NotificationContent content = holder.content;
addReplyAction(builder, content, notificationId);
addMarkAsReadAction(builder, content, notificationId);
addDeleteAction(builder, content, notificationId);
return builder;
}
Aggregations