diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index c3cf7d20c..1685ccf58 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -586,7 +586,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme Log.i(K9.LOG_TAG, "MessageList sending message " + messageReference); - Intent i = MessageView.actionView(this, messageReference, messageRefs); + Intent i = MessageView.actionViewIntent(this, messageReference, messageRefs); startActivity(i); } diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 240ab0378..1e3e663bf 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -14,6 +14,7 @@ import com.fsck.k9.Preferences; import com.fsck.k9.R; import com.fsck.k9.activity.misc.SwipeGestureDetector; import com.fsck.k9.activity.misc.SwipeGestureDetector.OnSwipeGestureListener; +import com.fsck.k9.controller.MessagingController; import com.fsck.k9.crypto.PgpData; import com.fsck.k9.fragment.MessageViewFragment; import com.fsck.k9.fragment.MessageViewFragment.MessageViewFragmentListener; @@ -41,6 +42,7 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme private static final String EXTRA_MESSAGE_REFERENCE = "com.fsck.k9.MessageView_messageReference"; private static final String EXTRA_MESSAGE_REFERENCES = "com.fsck.k9.MessageView_messageReferences"; + private static final String EXTRA_FROM_NOTIFICATION ="com.fsck.k9.MessageView_fromNotification"; /** * @see #mLastDirection @@ -49,7 +51,7 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme private static final int NEXT = 2; - public static Intent actionView(Context context, MessageReference messRef, + public static Intent actionViewIntent(Context context, MessageReference messRef, ArrayList messReferences) { Intent i = new Intent(context, MessageView.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); @@ -58,6 +60,12 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme return i; } + public static Intent actionHandleNotificationIntent(Context context, MessageReference ref) { + Intent i = actionViewIntent(context, ref, null); + i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); + i.putExtra(EXTRA_FROM_NOTIFICATION, true); + return i; + } private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation(); private Account mAccount; @@ -163,6 +171,9 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme onAccountUnavailable(); return; } + if (getIntent().getBooleanExtra(EXTRA_FROM_NOTIFICATION, false)) { + MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount); + } StorageManager.getInstance(getApplication()).addListener(mStorageListener); } diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 47a1a8f4e..1da0e8748 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -4703,7 +4703,8 @@ public class MessagingController implements Runnable { Intent targetIntent; if (unreadCount == 1) { - targetIntent = MessageView.actionView(context, message.makeMessageReference(), null); + targetIntent = MessageView.actionHandleNotificationIntent( + context, message.makeMessageReference()); } else { String initialFolder = message.getFolder().getName(); /* only go to folder if all messages are in the same folder, else go to folder list */