1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

added mIgnoreOnStop for when adding an attachment.

This commit is contained in:
ashley willis 2011-11-03 15:38:53 -05:00
parent a021ab71de
commit 7f582f5a38

View File

@ -212,6 +212,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
private boolean mDraftNeedsSaving = false; private boolean mDraftNeedsSaving = false;
private boolean mPreventDraftSaving = 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 * 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. * 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 @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
mIgnoreOnStop = false;
MessagingController.getInstance(getApplication()).addListener(mListener); MessagingController.getInstance(getApplication()).addListener(mListener);
} }
@ -799,8 +802,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
super.onStop(); super.onStop();
// don't do this if only changing orientations // don't do this if only changing orientations
if ((getChangingConfigurations() & ActivityInfo.CONFIG_ORIENTATION) == 0) { if ((getChangingConfigurations() & ActivityInfo.CONFIG_ORIENTATION) == 0) {
// don't do this if selecting signature or if "Encrypt" is checked // don't do this if selecting signature or if "Encrypt" is checked or if adding an attachment
if (!mPreventDraftSaving && !mEncryptCheckbox.isChecked()){ if (!mPreventDraftSaving && !mEncryptCheckbox.isChecked() && !mIgnoreOnStop){
saveIfNeeded(); saveIfNeeded();
finish(); 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. * Kick off a picker for whatever kind of MIME types we'll accept and let Android take over.
*/ */
private void onAddAttachment() { private void onAddAttachment() {
mIgnoreOnStop = true;
if (K9.isGalleryBuggy()) { if (K9.isGalleryBuggy()) {
if (K9.useGalleryBugWorkaround()) { if (K9.useGalleryBugWorkaround()) {
Toast.makeText(MessageCompose.this, Toast.makeText(MessageCompose.this,
@ -2626,7 +2630,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
private class SaveMessageTask extends AsyncTask<Void, Void, Void> { private class SaveMessageTask extends AsyncTask<Void, Void, Void> {
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
/* /*
* Create the message from all the data the user has entered. * Create the message from all the data the user has entered.
*/ */