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.");
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations