1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Override onStop() to save email as draft when activity is changed (go to home screen, call received)

This commit is contained in:
ashley willis 2011-11-01 22:12:51 -05:00
parent 57b9321a1e
commit a021ab71de

View File

@ -793,6 +793,20 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
MessagingController.getInstance(getApplication()).removeListener(mListener);
}
// Save email as draft when activity is changed (go to home screen, call received)
@Override
public void onStop() {
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()){
saveIfNeeded();
finish();
}
}
}
/**
* The framework handles most of the fields, but we need to handle stuff that we
* dynamically show and hide: