Search in sources :

Example 26 with Builder

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);
}
Also used : WearableExtender(android.support.v4.app.NotificationCompat.WearableExtender) NotificationCompat(android.support.v4.app.NotificationCompat) WearableExtender(android.support.v4.app.NotificationCompat.WearableExtender)

Example 27 with Builder

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());
}
Also used : Context(android.content.Context) NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent)

Example 28 with Builder

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());
}
Also used : Context(android.content.Context) NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent)

Example 29 with Builder

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;
}
Also used : BigTextStyle(android.support.v4.app.NotificationCompat.BigTextStyle) Builder(android.support.v4.app.NotificationCompat.Builder) NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent)

Example 30 with 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;
}
Also used : Builder(android.support.v4.app.NotificationCompat.Builder)

Aggregations

NotificationCompat (android.support.v4.app.NotificationCompat)105 PendingIntent (android.app.PendingIntent)86 Intent (android.content.Intent)76 NotificationManager (android.app.NotificationManager)35 Notification (android.app.Notification)29 Builder (android.support.v4.app.NotificationCompat.Builder)19 Context (android.content.Context)16 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)14 Uri (android.net.Uri)11 Bundle (android.os.Bundle)10 Bitmap (android.graphics.Bitmap)9 View (android.view.View)9 RemoteViews (android.widget.RemoteViews)9 IOException (java.io.IOException)9 AlertDialog (android.app.AlertDialog)7 DialogInterface (android.content.DialogInterface)7 Paint (android.graphics.Paint)6 SpannableString (android.text.SpannableString)6 TypedValue (android.util.TypedValue)6 TextView (android.widget.TextView)6