Search in sources :

Example 1 with WearableExtender

use of android.support.v4.app.NotificationCompat.WearableExtender in project SeriesGuide by UweTrottmann.

the class NotificationService method maybeSetPoster.

private void maybeSetPoster(NotificationCompat.Builder nb, String posterPath) {
    try {
        Bitmap poster = ServiceUtils.loadWithPicasso(this, TvdbImageTools.smallSizeUrl(posterPath)).centerCrop().resizeDimen(R.dimen.show_poster_width, R.dimen.show_poster_height).get();
        nb.setLargeIcon(poster);
        // add special large resolution background for wearables
        // https://developer.android.com/training/wearables/notifications/creating.html#AddWearableFeatures
        Bitmap posterSquare = ServiceUtils.loadWithPicasso(this, TvdbImageTools.fullSizeUrl(posterPath)).centerCrop().resize(400, 400).get();
        NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender().setBackground(posterSquare);
        nb.extend(wearableExtender);
    } catch (IOException e) {
        Timber.e(e, "maybeSetPoster: failed.");
    }
}
Also used : Bitmap(android.graphics.Bitmap) NotificationCompat(android.support.v4.app.NotificationCompat) IOException(java.io.IOException)

Example 2 with WearableExtender

use of android.support.v4.app.NotificationCompat.WearableExtender in project k-9 by k9mail.

the class WearNotifications method addSummaryActions.

public void addSummaryActions(Builder builder, NotificationData notificationData) {
    NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
    addMarkAllAsReadAction(wearableExtender, notificationData);
    if (isDeleteActionAvailableForWear()) {
        addDeleteAllAction(wearableExtender, notificationData);
    }
    Account account = notificationData.getAccount();
    if (isArchiveActionAvailableForWear(account)) {
        addArchiveAllAction(wearableExtender, notificationData);
    }
    builder.extend(wearableExtender);
}
Also used : Account(com.fsck.k9.Account) WearableExtender(android.support.v4.app.NotificationCompat.WearableExtender) NotificationCompat(android.support.v4.app.NotificationCompat) WearableExtender(android.support.v4.app.NotificationCompat.WearableExtender)

Example 3 with WearableExtender

use of android.support.v4.app.NotificationCompat.WearableExtender 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 4 with WearableExtender

use of android.support.v4.app.NotificationCompat.WearableExtender in project k-9 by k9mail.

the class WearNotifications method addArchiveAction.

private void addArchiveAction(WearableExtender wearableExtender, NotificationHolder holder) {
    int icon = R.drawable.ic_action_archive_dark;
    String title = context.getString(R.string.notification_action_archive);
    MessageReference messageReference = holder.content.messageReference;
    int notificationId = holder.notificationId;
    PendingIntent action = actionCreator.createArchiveMessagePendingIntent(messageReference, notificationId);
    NotificationCompat.Action archiveAction = new NotificationCompat.Action.Builder(icon, title, action).build();
    wearableExtender.addAction(archiveAction);
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent) MessageReference(com.fsck.k9.activity.MessageReference)

Example 5 with WearableExtender

use of android.support.v4.app.NotificationCompat.WearableExtender in project k-9 by k9mail.

the class WearNotifications method addDeleteAction.

private void addDeleteAction(WearableExtender wearableExtender, NotificationHolder holder) {
    int icon = R.drawable.ic_action_delete_dark;
    String title = context.getString(R.string.notification_action_delete);
    MessageReference messageReference = holder.content.messageReference;
    int notificationId = holder.notificationId;
    PendingIntent action = actionCreator.createDeleteMessagePendingIntent(messageReference, notificationId);
    NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build();
    wearableExtender.addAction(deleteAction);
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent) MessageReference(com.fsck.k9.activity.MessageReference)

Aggregations

NotificationCompat (android.support.v4.app.NotificationCompat)17 PendingIntent (android.app.PendingIntent)12 MessageReference (com.fsck.k9.activity.MessageReference)8 Intent (android.content.Intent)4 WearableExtender (android.support.v4.app.NotificationCompat.WearableExtender)4 Account (com.fsck.k9.Account)4 Notification (android.app.Notification)3 Bitmap (android.graphics.Bitmap)2 RemoteInput (android.support.v4.app.RemoteInput)2 SuppressLint (android.annotation.SuppressLint)1 NotificationManager (android.app.NotificationManager)1 SharedPreferences (android.content.SharedPreferences)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageManager (android.content.pm.PackageManager)1 Paint (android.graphics.Paint)1 PowerManager (android.os.PowerManager)1 NotificationManagerCompat (android.preview.support.v4.app.NotificationManagerCompat)1 StatusBarNotification (android.service.notification.StatusBarNotification)1 BigTextStyle (android.support.v4.app.NotificationCompat.BigTextStyle)1 IOException (java.io.IOException)1