From 7f582f5a38a1dcb568a049f0d39fce0f7297f0a8 Mon Sep 17 00:00:00 2001 From: ashley willis Date: Thu, 3 Nov 2011 15:38:53 -0500 Subject: [PATCH] added mIgnoreOnStop for when adding an attachment. --- src/com/fsck/k9/activity/MessageCompose.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index 80582e028..98168b514 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -212,6 +212,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc private boolean mDraftNeedsSaving = false; private boolean mPreventDraftSaving = false; + private boolean mIgnoreOnStop = false; + /** * The draft uid of this message. This is used when saving drafts so that the same draft is * overwritten instead of being created anew. This property is null until the first save. @@ -784,6 +786,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc @Override public void onResume() { super.onResume(); + mIgnoreOnStop = false; MessagingController.getInstance(getApplication()).addListener(mListener); } @@ -799,8 +802,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc super.onStop(); // don't do this if only changing orientations if ((getChangingConfigurations() & ActivityInfo.CONFIG_ORIENTATION) == 0) { - // don't do this if selecting signature or if "Encrypt" is checked - if (!mPreventDraftSaving && !mEncryptCheckbox.isChecked()){ + // don't do this if selecting signature or if "Encrypt" is checked or if adding an attachment + if (!mPreventDraftSaving && !mEncryptCheckbox.isChecked() && !mIgnoreOnStop){ saveIfNeeded(); finish(); } @@ -1467,6 +1470,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc * Kick off a picker for whatever kind of MIME types we'll accept and let Android take over. */ private void onAddAttachment() { + mIgnoreOnStop = true; if (K9.isGalleryBuggy()) { if (K9.useGalleryBugWorkaround()) { Toast.makeText(MessageCompose.this, @@ -2626,7 +2630,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc private class SaveMessageTask extends AsyncTask { @Override protected Void doInBackground(Void... params) { - /* * Create the message from all the data the user has entered. */