use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class WearNotifications method addDeviceDeleteAction.
private void addDeviceDeleteAction(Builder builder, NotificationHolder holder) {
if (!isDeleteActionEnabled()) {
return;
}
int icon = R.drawable.notification_action_delete;
String title = context.getString(R.string.notification_action_delete);
NotificationContent content = holder.content;
int notificationId = holder.notificationId;
MessageReference messageReference = content.messageReference;
PendingIntent action = actionCreator.createDeleteMessagePendingIntent(messageReference, notificationId);
builder.addAction(icon, title, action);
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class NotificationContentCreator method createFromMessage.
public NotificationContent createFromMessage(Account account, LocalMessage message) {
MessageReference messageReference = message.makeMessageReference();
String sender = getMessageSender(account, message);
String displaySender = getMessageSenderForDisplay(sender);
String subject = getMessageSubject(message);
CharSequence preview = getMessagePreview(message);
CharSequence summary = buildMessageSummary(sender, subject);
boolean starred = message.isSet(Flag.FLAGGED);
return new NotificationContent(messageReference, displaySender, subject, preview, summary, starred);
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class NotificationActionCreator method getFolderNameOfAllMessages.
private String getFolderNameOfAllMessages(List<MessageReference> messageReferences) {
MessageReference firstMessage = messageReferences.get(0);
String folderName = firstMessage.getFolderName();
for (MessageReference messageReference : messageReferences) {
if (!TextUtils.equals(folderName, messageReference.getFolderName())) {
return null;
}
}
return folderName;
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class NotificationActionService method markMessagesAsRead.
private void markMessagesAsRead(Intent intent, Account account, MessagingController controller) {
Timber.i("NotificationActionService marking messages as read");
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
for (MessageReference messageReference : messageReferences) {
String folderName = messageReference.getFolderName();
String uid = messageReference.getUid();
controller.setFlag(account, folderName, uid, Flag.SEEN, true);
}
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class NotificationActionService method archiveMessages.
private void archiveMessages(Intent intent, Account account, MessagingController controller) {
Timber.i("NotificationActionService archiving messages");
String archiveFolderName = account.getArchiveFolderName();
if (archiveFolderName == null || (archiveFolderName.equals(account.getSpamFolderName()) && K9.confirmSpam()) || !isMovePossible(controller, account, archiveFolderName)) {
Timber.w("Can not archive messages");
return;
}
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
for (MessageReference messageReference : messageReferences) {
if (controller.isMoveCapable(messageReference)) {
String sourceFolderName = messageReference.getFolderName();
controller.moveMessage(account, sourceFolderName, messageReference, archiveFolderName);
}
}
}
Aggregations