1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-08 20:28:34 -05:00

#619 "Add android wear support"

removed dontCancel
update (stacked) notifications after a notification action was invoked
merged upstream changes
This commit is contained in:
Marcus Wolschon 2015-07-05 11:36:53 +02:00
parent 92cfe149e2
commit 99115130ad

View File

@ -220,6 +220,10 @@ public class MessagingController implements Runnable {
* {@link #removeMatchingMessage(android.content.Context, com.fsck.k9.activity.MessageReference)} instead. * {@link #removeMatchingMessage(android.content.Context, com.fsck.k9.activity.MessageReference)} instead.
*/ */
LinkedList<LocalMessage> messages; LinkedList<LocalMessage> messages;
/**
* Stacked notifications that share this notification as ther summary-notification.
*/
Map<String, Integer> stackedNotifications = new HashMap<String, Integer>();
/** /**
* List of references for messages that the user is still to be notified of, * List of references for messages that the user is still to be notified of,
* but which don't fit into the inbox style anymore. It's sorted from newest * but which don't fit into the inbox style anymore. It's sorted from newest
@ -303,7 +307,8 @@ public class MessagingController implements Runnable {
/** /**
* Remove a certain message from the message list. * Remove a certain message from the message list.
* * @see #getStackedChildNotification(com.fsck.k9.activity.MessageReference) for stacked
* notifications you may consider to cancel.
* @param context A context. * @param context A context.
* @param ref Reference of the message to remove * @param ref Reference of the message to remove
* @return true if message was found and removed, false otherwise * @return true if message was found and removed, false otherwise
@ -4767,9 +4772,9 @@ public class MessagingController implements Runnable {
* @param message the single message we intent to act on (in a stacked notification or a summary notification about a single message) * @param message the single message we intent to act on (in a stacked notification or a summary notification about a single message)
* @param notificationID the id of the future notification. Will be used in the intents, so afterwards the correct notification gets closed. * @param notificationID the id of the future notification. Will be used in the intents, so afterwards the correct notification gets closed.
*/ */
private void addWearActions(final NotificationCompat.Builder builder, final int totalMsgCount, final Account account, final Message message, final int notificationID) { private void addWearActions(final NotificationCompat.Builder builder, final int totalMsgCount, final Account account, final LocalMessage message, final int notificationID) {
ArrayList<MessageReference> subAllRefs = new ArrayList<MessageReference>(); ArrayList<MessageReference> subAllRefs = new ArrayList<MessageReference>();
subAllRefs.add(new MessageReference(account.getUuid(), message.getFolder().getName(), message.getUid(), message.getFlags().size()==0?null:message.getFlags().iterator().next())); subAllRefs.add(message.makeMessageReference());
LinkedList<Message> msgList = new LinkedList<Message>(); LinkedList<Message> msgList = new LinkedList<Message>();
msgList.add(message); msgList.add(message);
addWearActions(builder, totalMsgCount, 1, account, subAllRefs, msgList, notificationID); addWearActions(builder, totalMsgCount, 1, account, subAllRefs, msgList, notificationID);
@ -5004,28 +5009,6 @@ public class MessagingController implements Runnable {
context.getString(R.string.notification_action_delete), context.getString(R.string.notification_action_delete),
NotificationDeleteConfirmation.getIntent(context, account, allRefs, account.getAccountNumber())); NotificationDeleteConfirmation.getIntent(context, account, allRefs, account.getAccountNumber()));
} }
if (NotificationActionService.isArchiveAllMessagesWearAvaliable(context, account, data.messages)) {
// Archive on wear
NotificationCompat.Action wearActionArchive =
new NotificationCompat.Action.Builder(
R.drawable.ic_action_delete_dark,
context.getString(R.string.notification_action_archive),
NotificationActionService.getArchiveAllMessagesIntent(context, account, allRefs))
.build();
builder.extend(wearableExtender.addAction(wearActionArchive));
}
if (NotificationActionService.isSpamAllMessagesWearAvaliable(context, account, data.messages)) {
// Archive on wear
NotificationCompat.Action wearActionSpam =
new NotificationCompat.Action.Builder(
R.drawable.ic_action_delete_dark,
context.getString(R.string.notification_action_spam),
NotificationActionService.getSpamAllMessagesIntent(context, account, allRefs))
.build();
builder.extend(wearableExtender.addAction(wearActionSpam));
}
} else { } else {
String accountNotice = context.getString(R.string.notification_new_one_account_fmt, String accountNotice = context.getString(R.string.notification_new_one_account_fmt,
unreadCount, accountDescr); unreadCount, accountDescr);