1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-28 04:02:19 -05:00

Remove duplicate code from onCompose. make starting message composition without an account actually work

This commit is contained in:
Jesse Vincent 2009-12-27 17:22:44 +00:00
parent 0a2d9b9c9f
commit 6c383256a2

View File

@ -252,6 +252,26 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
setContentView(R.layout.message_compose); setContentView(R.layout.message_compose);
Intent intent = getIntent();
mAccount = (Account) intent.getSerializableExtra(EXTRA_ACCOUNT);
if (mAccount == null)
{
mAccount = Preferences.getPreferences(this).getDefaultAccount();
}
if (mAccount == null)
{
/*
* There are no accounts set up. This should not have happened. Prompt the
* user to set up an account as an acceptable bailout.
*/
startActivity(new Intent(this, Accounts.class));
mDraftNeedsSaving = false;
finish();
return;
}
mAddressAdapter = new EmailAddressAdapter(this); mAddressAdapter = new EmailAddressAdapter(this);
mAddressValidator = new EmailAddressValidator(); mAddressValidator = new EmailAddressValidator();
@ -341,7 +361,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
mSourceMessageProcessed = savedInstanceState.getBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, false); mSourceMessageProcessed = savedInstanceState.getBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, false);
} }
Intent intent = getIntent();
String action = intent.getAction(); String action = intent.getAction();
@ -350,18 +369,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
/* /*
* Someone has clicked a mailto: link. The address is in the URI. * Someone has clicked a mailto: link. The address is in the URI.
*/ */
mAccount = Preferences.getPreferences(this).getDefaultAccount();
if (mAccount == null)
{
/*
* There are no accounts set up. This should not have happened. Prompt the
* user to set up an account as an acceptable bailout.
*/
startActivity(new Intent(this, Accounts.class));
mDraftNeedsSaving = false;
finish();
return;
}
if (intent.getData() != null) if (intent.getData() != null)
{ {
Uri uri = intent.getData(); Uri uri = intent.getData();
@ -389,19 +396,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
* The Intent should contain an EXTRA_STREAM with the data to attach. * The Intent should contain an EXTRA_STREAM with the data to attach.
*/ */
mAccount = Preferences.getPreferences(this).getDefaultAccount();
if (mAccount == null)
{
/*
* There are no accounts set up. This should not have happened. Prompt the
* user to set up an account as an acceptable bailout.
*/
startActivity(new Intent(this, Accounts.class));
mDraftNeedsSaving = false;
finish();
return;
}
String text = intent.getStringExtra(Intent.EXTRA_TEXT); String text = intent.getStringExtra(Intent.EXTRA_TEXT);
if (text != null) if (text != null)
{ {
@ -478,7 +472,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
} }
else else
{ {
mAccount = (Account) intent.getSerializableExtra(EXTRA_ACCOUNT);
mFolder = (String) intent.getStringExtra(EXTRA_FOLDER); mFolder = (String) intent.getStringExtra(EXTRA_FOLDER);
mSourceMessageUid = (String) intent.getStringExtra(EXTRA_MESSAGE); mSourceMessageUid = (String) intent.getStringExtra(EXTRA_MESSAGE);
} }