Loading app/core/src/main/java/com/fsck/k9/notification/NotificationActionCreator.java +0 −6 Original line number Diff line number Diff line Loading @@ -32,9 +32,6 @@ public interface NotificationActionCreator { PendingIntent createMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent getMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent getEditIncomingServerSettingsIntent(Account account); PendingIntent getEditOutgoingServerSettingsIntent(Account account); Loading @@ -44,9 +41,6 @@ public interface NotificationActionCreator { PendingIntent createDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent getDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent createArchiveMessagePendingIntent(MessageReference messageReference, int notificationId); PendingIntent createArchiveAllPendingIntent(Account account, List<MessageReference> messageReferences, Loading app/core/src/main/java/com/fsck/k9/notification/WearNotifications.java +3 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,8 @@ class WearNotifications extends BaseNotifications { Account account = notificationData.getAccount(); ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences(); int notificationId = NotificationIds.getNewMailSummaryNotificationId(account); PendingIntent action = actionCreator.getMarkAllAsReadPendingIntent(account, messageReferences, notificationId); PendingIntent action = actionCreator.createMarkAllAsReadPendingIntent( account, messageReferences, notificationId); NotificationCompat.Action markAsReadAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(markAsReadAction); Loading @@ -74,7 +75,7 @@ class WearNotifications extends BaseNotifications { Account account = notificationData.getAccount(); ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences(); int notificationId = NotificationIds.getNewMailSummaryNotificationId(account); PendingIntent action = actionCreator.getDeleteAllPendingIntent(account, messageReferences, notificationId); PendingIntent action = actionCreator.createDeleteAllPendingIntent(account, messageReferences, notificationId); NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(deleteAction); Loading app/core/src/test/java/com/fsck/k9/notification/WearNotificationsTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ public class WearNotificationsTest extends RobolectricTest { ArrayList<MessageReference> messageReferences = createMessageReferenceList(); NotificationData notificationData = createNotificationData(messageReferences); PendingIntent markAllAsReadPendingIntent = createFakePendingIntent(1); when(actionCreator.getMarkAllAsReadPendingIntent(account, messageReferences, notificationId)) when(actionCreator.createMarkAllAsReadPendingIntent(account, messageReferences, notificationId)) .thenReturn(markAllAsReadPendingIntent); wearNotifications.addSummaryActions(builder, notificationData); Loading @@ -160,7 +160,7 @@ public class WearNotificationsTest extends RobolectricTest { ArrayList<MessageReference> messageReferences = createMessageReferenceList(); NotificationData notificationData = createNotificationData(messageReferences); PendingIntent deletePendingIntent = createFakePendingIntent(1); when(actionCreator.getDeleteAllPendingIntent(account, messageReferences, notificationId)) when(actionCreator.createDeleteAllPendingIntent(account, messageReferences, notificationId)) .thenReturn(deletePendingIntent); wearNotifications.addSummaryActions(builder, notificationData); Loading app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationActionCreator.java +9 −36 Original line number Diff line number Diff line Loading @@ -112,15 +112,10 @@ class K9NotificationActionCreator implements NotificationActionCreator { @Override public PendingIntent createMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { return getMarkAsReadPendingIntent(account, messageReferences, notificationId, context, PendingIntent.FLAG_UPDATE_CURRENT); } String accountUuid = account.getUuid(); Intent intent = NotificationActionService.createMarkAllAsReadIntent(context, accountUuid, messageReferences); @Override public PendingIntent getMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { return getMarkAsReadPendingIntent(account, messageReferences, notificationId, context, PendingIntent.FLAG_UPDATE_CURRENT); return PendingIntent.getService(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT); } @Override Loading @@ -139,14 +134,6 @@ class K9NotificationActionCreator implements NotificationActionCreator { PendingIntent.FLAG_UPDATE_CURRENT); } private PendingIntent getMarkAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId, Context context, int flags) { String accountUuid = account.getUuid(); Intent intent = NotificationActionService.createMarkAllAsReadIntent(context, accountUuid, messageReferences); return PendingIntent.getService(context, notificationId, intent, flags); } @Override public PendingIntent createDeleteMessagePendingIntent(MessageReference messageReference, int notificationId) { if (K9.confirmDeleteFromNotification()) { Loading @@ -172,40 +159,26 @@ class K9NotificationActionCreator implements NotificationActionCreator { public PendingIntent createDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { if (K9.confirmDeleteFromNotification()) { return getDeleteAllConfirmationPendingIntent(messageReferences, notificationId, PendingIntent.FLAG_CANCEL_CURRENT); return getDeleteAllConfirmationPendingIntent(messageReferences, notificationId); } else { return getDeleteAllServicePendingIntent(account, messageReferences, notificationId, PendingIntent.FLAG_UPDATE_CURRENT); } } @Override public PendingIntent getDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { if (K9.confirmDeleteFromNotification()) { return getDeleteAllConfirmationPendingIntent(messageReferences, notificationId, PendingIntent.FLAG_UPDATE_CURRENT); } else { return getDeleteAllServicePendingIntent(account, messageReferences, notificationId, PendingIntent.FLAG_UPDATE_CURRENT); return getDeleteAllServicePendingIntent(account, messageReferences, notificationId); } } private PendingIntent getDeleteAllConfirmationPendingIntent(List<MessageReference> messageReferences, int notificationId, int flags) { int notificationId) { Intent intent = NotificationDeleteConfirmation.getIntent(context, messageReferences); return PendingIntent.getActivity(context, notificationId, intent, flags); return PendingIntent.getActivity(context, notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT); } private PendingIntent getDeleteAllServicePendingIntent(Account account, List<MessageReference> messageReferences, int notificationId, int flags) { int notificationId) { String accountUuid = account.getUuid(); Intent intent = NotificationActionService.createDeleteAllMessagesIntent( context, accountUuid, messageReferences); return PendingIntent.getService(context, notificationId, intent, flags); return PendingIntent.getService(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT); } @Override Loading Loading
app/core/src/main/java/com/fsck/k9/notification/NotificationActionCreator.java +0 −6 Original line number Diff line number Diff line Loading @@ -32,9 +32,6 @@ public interface NotificationActionCreator { PendingIntent createMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent getMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent getEditIncomingServerSettingsIntent(Account account); PendingIntent getEditOutgoingServerSettingsIntent(Account account); Loading @@ -44,9 +41,6 @@ public interface NotificationActionCreator { PendingIntent createDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent getDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId); PendingIntent createArchiveMessagePendingIntent(MessageReference messageReference, int notificationId); PendingIntent createArchiveAllPendingIntent(Account account, List<MessageReference> messageReferences, Loading
app/core/src/main/java/com/fsck/k9/notification/WearNotifications.java +3 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,8 @@ class WearNotifications extends BaseNotifications { Account account = notificationData.getAccount(); ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences(); int notificationId = NotificationIds.getNewMailSummaryNotificationId(account); PendingIntent action = actionCreator.getMarkAllAsReadPendingIntent(account, messageReferences, notificationId); PendingIntent action = actionCreator.createMarkAllAsReadPendingIntent( account, messageReferences, notificationId); NotificationCompat.Action markAsReadAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(markAsReadAction); Loading @@ -74,7 +75,7 @@ class WearNotifications extends BaseNotifications { Account account = notificationData.getAccount(); ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences(); int notificationId = NotificationIds.getNewMailSummaryNotificationId(account); PendingIntent action = actionCreator.getDeleteAllPendingIntent(account, messageReferences, notificationId); PendingIntent action = actionCreator.createDeleteAllPendingIntent(account, messageReferences, notificationId); NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(deleteAction); Loading
app/core/src/test/java/com/fsck/k9/notification/WearNotificationsTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ public class WearNotificationsTest extends RobolectricTest { ArrayList<MessageReference> messageReferences = createMessageReferenceList(); NotificationData notificationData = createNotificationData(messageReferences); PendingIntent markAllAsReadPendingIntent = createFakePendingIntent(1); when(actionCreator.getMarkAllAsReadPendingIntent(account, messageReferences, notificationId)) when(actionCreator.createMarkAllAsReadPendingIntent(account, messageReferences, notificationId)) .thenReturn(markAllAsReadPendingIntent); wearNotifications.addSummaryActions(builder, notificationData); Loading @@ -160,7 +160,7 @@ public class WearNotificationsTest extends RobolectricTest { ArrayList<MessageReference> messageReferences = createMessageReferenceList(); NotificationData notificationData = createNotificationData(messageReferences); PendingIntent deletePendingIntent = createFakePendingIntent(1); when(actionCreator.getDeleteAllPendingIntent(account, messageReferences, notificationId)) when(actionCreator.createDeleteAllPendingIntent(account, messageReferences, notificationId)) .thenReturn(deletePendingIntent); wearNotifications.addSummaryActions(builder, notificationData); Loading
app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationActionCreator.java +9 −36 Original line number Diff line number Diff line Loading @@ -112,15 +112,10 @@ class K9NotificationActionCreator implements NotificationActionCreator { @Override public PendingIntent createMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { return getMarkAsReadPendingIntent(account, messageReferences, notificationId, context, PendingIntent.FLAG_UPDATE_CURRENT); } String accountUuid = account.getUuid(); Intent intent = NotificationActionService.createMarkAllAsReadIntent(context, accountUuid, messageReferences); @Override public PendingIntent getMarkAllAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { return getMarkAsReadPendingIntent(account, messageReferences, notificationId, context, PendingIntent.FLAG_UPDATE_CURRENT); return PendingIntent.getService(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT); } @Override Loading @@ -139,14 +134,6 @@ class K9NotificationActionCreator implements NotificationActionCreator { PendingIntent.FLAG_UPDATE_CURRENT); } private PendingIntent getMarkAsReadPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId, Context context, int flags) { String accountUuid = account.getUuid(); Intent intent = NotificationActionService.createMarkAllAsReadIntent(context, accountUuid, messageReferences); return PendingIntent.getService(context, notificationId, intent, flags); } @Override public PendingIntent createDeleteMessagePendingIntent(MessageReference messageReference, int notificationId) { if (K9.confirmDeleteFromNotification()) { Loading @@ -172,40 +159,26 @@ class K9NotificationActionCreator implements NotificationActionCreator { public PendingIntent createDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { if (K9.confirmDeleteFromNotification()) { return getDeleteAllConfirmationPendingIntent(messageReferences, notificationId, PendingIntent.FLAG_CANCEL_CURRENT); return getDeleteAllConfirmationPendingIntent(messageReferences, notificationId); } else { return getDeleteAllServicePendingIntent(account, messageReferences, notificationId, PendingIntent.FLAG_UPDATE_CURRENT); } } @Override public PendingIntent getDeleteAllPendingIntent(Account account, List<MessageReference> messageReferences, int notificationId) { if (K9.confirmDeleteFromNotification()) { return getDeleteAllConfirmationPendingIntent(messageReferences, notificationId, PendingIntent.FLAG_UPDATE_CURRENT); } else { return getDeleteAllServicePendingIntent(account, messageReferences, notificationId, PendingIntent.FLAG_UPDATE_CURRENT); return getDeleteAllServicePendingIntent(account, messageReferences, notificationId); } } private PendingIntent getDeleteAllConfirmationPendingIntent(List<MessageReference> messageReferences, int notificationId, int flags) { int notificationId) { Intent intent = NotificationDeleteConfirmation.getIntent(context, messageReferences); return PendingIntent.getActivity(context, notificationId, intent, flags); return PendingIntent.getActivity(context, notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT); } private PendingIntent getDeleteAllServicePendingIntent(Account account, List<MessageReference> messageReferences, int notificationId, int flags) { int notificationId) { String accountUuid = account.getUuid(); Intent intent = NotificationActionService.createDeleteAllMessagesIntent( context, accountUuid, messageReferences); return PendingIntent.getService(context, notificationId, intent, flags); return PendingIntent.getService(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT); } @Override Loading