AccountSetupAccountTypepublic class AccountSetupAccountType extends android.app.Activity implements android.view.View.OnClickListenerPrompts the user to select an account type. The account type, along with the
passed in email address, password and makeDefault are then passed on to the
AccountSetupIncoming activity. |
Fields Summary |
---|
private static final String | EXTRA_ACCOUNT | private static final String | EXTRA_MAKE_DEFAULT | private com.android.email.Account | mAccount | private boolean | mMakeDefault |
Methods Summary |
---|
public static void | actionSelectAccountType(android.content.Context context, com.android.email.Account account, boolean makeDefault)
Intent i = new Intent(context, AccountSetupAccountType.class);
i.putExtra(EXTRA_ACCOUNT, account);
i.putExtra(EXTRA_MAKE_DEFAULT, makeDefault);
context.startActivity(i);
| public void | onClick(android.view.View v)
switch (v.getId()) {
case R.id.pop:
onPop();
break;
case R.id.imap:
onImap();
break;
}
| public void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.account_setup_account_type);
((Button)findViewById(R.id.pop)).setOnClickListener(this);
((Button)findViewById(R.id.imap)).setOnClickListener(this);
mAccount = (Account)getIntent().getSerializableExtra(EXTRA_ACCOUNT);
mMakeDefault = (boolean)getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false);
| private void | onImap()The user has selected an IMAP account type. Try to put together a URI using the entered
email address. Also set the mail delete policy here, because there is no UI (for IMAP).
try {
URI uri = new URI(mAccount.getStoreUri());
uri = new URI("imap", uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null);
mAccount.setStoreUri(uri.toString());
} catch (URISyntaxException use) {
/*
* This should not happen.
*/
throw new Error(use);
}
// Delete policy must be set explicitly, because IMAP does not provide a UI selection
// for it. This logic needs to be followed in the auto setup flow as well.
mAccount.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
| private void | onPop()
try {
URI uri = new URI(mAccount.getStoreUri());
uri = new URI("pop3", uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null);
mAccount.setStoreUri(uri.toString());
} catch (URISyntaxException use) {
/*
* This should not happen.
*/
throw new Error(use);
}
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
|
|