From 4c1060ecae19cb03e4ca1e67eae3480d308b3f62 Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 28 Jul 2010 23:17:46 +0000 Subject: [PATCH] Only show "save or discard" dialog before leaving the message compose activity if the message needs saving. --- src/com/fsck/k9/activity/MessageCompose.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index 529d9d5f2..35ff9a791 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -36,7 +36,6 @@ import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.Window; import android.widget.AutoCompleteTextView.Validator; -import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageButton; @@ -1528,12 +1527,20 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc return true; } + @Override public void onBackPressed() { // This will be called either automatically for you on 2.0 // or later, or by the code above on earlier versions of the // platform. - showDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE); + if (mDraftNeedsSaving) + { + showDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE); + } + else + { + finish(); + } } @Override @@ -2156,6 +2163,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc private class SendMessageTask extends AsyncTask { + @Override protected Void doInBackground(Void... params) { /* @@ -2185,6 +2193,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc private class SaveMessageTask extends AsyncTask { + @Override protected Void doInBackground(Void... params) {