Search in sources :

Example 46 with MessageReference

use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.

the class WearNotifications method addDeviceMarkAsReadAction.

private void addDeviceMarkAsReadAction(Builder builder, NotificationHolder holder) {
    int icon = R.drawable.notification_action_mark_as_read;
    String title = context.getString(R.string.notification_action_mark_as_read);
    NotificationContent content = holder.content;
    int notificationId = holder.notificationId;
    MessageReference messageReference = content.messageReference;
    PendingIntent action = actionCreator.createMarkMessageAsReadPendingIntent(messageReference, notificationId);
    builder.addAction(icon, title, action);
}
Also used : PendingIntent(android.app.PendingIntent) MessageReference(com.fsck.k9.activity.MessageReference)

Example 47 with MessageReference

use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.

the class WearNotifications method addMarkAllAsReadAction.

private void addMarkAllAsReadAction(WearableExtender wearableExtender, NotificationData notificationData) {
    int icon = R.drawable.ic_action_mark_as_read_dark;
    String title = context.getString(R.string.notification_action_mark_all_as_read);
    Account account = notificationData.getAccount();
    ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences();
    int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
    PendingIntent action = actionCreator.getMarkAllAsReadPendingIntent(account, messageReferences, notificationId);
    NotificationCompat.Action markAsReadAction = new NotificationCompat.Action.Builder(icon, title, action).build();
    wearableExtender.addAction(markAsReadAction);
}
Also used : Account(com.fsck.k9.Account) NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent) MessageReference(com.fsck.k9.activity.MessageReference)

Example 48 with MessageReference

use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.

the class WearNotifications method addDeleteAllAction.

private void addDeleteAllAction(WearableExtender wearableExtender, NotificationData notificationData) {
    int icon = R.drawable.ic_action_delete_dark;
    String title = context.getString(R.string.notification_action_delete_all);
    Account account = notificationData.getAccount();
    ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences();
    int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
    PendingIntent action = actionCreator.getDeleteAllPendingIntent(account, messageReferences, notificationId);
    NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build();
    wearableExtender.addAction(deleteAction);
}
Also used : Account(com.fsck.k9.Account) NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent) MessageReference(com.fsck.k9.activity.MessageReference)

Example 49 with MessageReference

use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.

the class WearNotifications method addReplyAction.

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

Example 50 with MessageReference

use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.

the class WearNotifications method addMarkAsReadAction.

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

Aggregations

MessageReference (com.fsck.k9.activity.MessageReference)49 PendingIntent (android.app.PendingIntent)25 Account (com.fsck.k9.Account)22 Test (org.junit.Test)14 LocalMessage (com.fsck.k9.mailstore.LocalMessage)13 MessageReference (com.fsck.k9.controller.MessageReference)12 NotificationCompat (android.support.v4.app.NotificationCompat)9 ArrayList (java.util.ArrayList)9 Notification (android.app.Notification)8 List (java.util.List)7 MessagingException (com.fsck.k9.mail.MessagingException)6 LocalFolder (com.fsck.k9.mailstore.LocalFolder)5 SearchAccount (com.fsck.k9.search.SearchAccount)5 HashMap (java.util.HashMap)5 Cursor (android.database.Cursor)3 Message (com.fsck.k9.mail.Message)3 LinkedList (java.util.LinkedList)3 Map (java.util.Map)3 Intent (android.content.Intent)2 Uri (android.net.Uri)2