Merge change Ie25ac73d into eclair-mr2
* changes: Fix "back key" flow for Email account setup
This commit is contained in:
commit
bb12286f28
|
@ -38,6 +38,11 @@ import android.os.Bundle;
|
|||
*/
|
||||
public class Welcome extends Activity {
|
||||
|
||||
public static void actionStart(Activity fromActivity) {
|
||||
Intent i = new Intent(fromActivity, Welcome.class);
|
||||
fromActivity.startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class AccountSetupAccountType extends Activity implements OnClickListener
|
|||
private Account mAccount;
|
||||
private boolean mMakeDefault;
|
||||
|
||||
public static void actionSelectAccountType(Activity fromActivity, Account account,
|
||||
public static void actionSelectAccountType(Activity fromActivity, Account account,
|
||||
boolean makeDefault, boolean easFlowMode) {
|
||||
Intent i = new Intent(fromActivity, AccountSetupAccountType.class);
|
||||
i.putExtra(EXTRA_ACCOUNT, account);
|
||||
|
@ -93,7 +93,6 @@ public class AccountSetupAccountType extends Activity implements OnClickListener
|
|||
throw new Error(use);
|
||||
}
|
||||
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
|
||||
finish();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,7 +114,6 @@ public class AccountSetupAccountType extends Activity implements OnClickListener
|
|||
// 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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,7 +139,6 @@ public class AccountSetupAccountType extends Activity implements OnClickListener
|
|||
mAccount.setSyncInterval(Account.CHECK_INTERVAL_PUSH);
|
||||
mAccount.setSyncLookback(1);
|
||||
AccountSetupExchange.actionIncomingSettings(this, mAccount, mMakeDefault, easFlowMode);
|
||||
finish();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,7 +174,7 @@ public class AccountSetupAccountType extends Activity implements OnClickListener
|
|||
Cursor c = null;
|
||||
try {
|
||||
c = this.getContentResolver().query(
|
||||
Account.CONTENT_URI,
|
||||
Account.CONTENT_URI,
|
||||
Account.CONTENT_PROJECTION,
|
||||
null, null, null);
|
||||
while (c.moveToNext()) {
|
||||
|
|
|
@ -21,8 +21,10 @@ import com.android.email.EmailAddressValidator;
|
|||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.activity.Debug;
|
||||
import com.android.email.activity.MessageList;
|
||||
import com.android.email.provider.EmailContent;
|
||||
import com.android.email.provider.EmailContent.Account;
|
||||
import com.android.email.provider.EmailContent.Mailbox;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -61,7 +63,15 @@ public class AccountSetupBasics extends Activity
|
|||
private final static boolean ENTER_DEBUG_SCREEN = true;
|
||||
|
||||
private final static String EXTRA_ACCOUNT = "com.android.email.AccountSetupBasics.account";
|
||||
private final static String EXTRA_EAS_FLOW = "com.android.email.extra.eas_flow";
|
||||
public final static String EXTRA_EAS_FLOW = "com.android.email.extra.eas_flow";
|
||||
|
||||
// Action asking us to return to our original caller (i.e. finish)
|
||||
private static final String ACTION_RETURN_TO_CALLER =
|
||||
"com.android.email.AccountSetupBasics.return";
|
||||
// Action asking us to restart the task from the Welcome activity (which will figure out the
|
||||
// right place to go) and finish
|
||||
private static final String ACTION_START_AT_MESSAGE_LIST =
|
||||
"com.android.email.AccountSetupBasics.messageList";
|
||||
|
||||
private final static int DIALOG_NOTE = 1;
|
||||
private final static int DIALOG_DUPLICATE_ACCOUNT = 2;
|
||||
|
@ -99,9 +109,43 @@ public class AccountSetupBasics extends Activity
|
|||
return i;
|
||||
}
|
||||
|
||||
public static void actionAccountCreateFinishedEas(Activity fromActivity) {
|
||||
Intent i= new Intent(fromActivity, AccountSetupBasics.class);
|
||||
// If we're in the "eas flow" (from AccountManager), we want to return to the caller
|
||||
// (in the settings app)
|
||||
i.putExtra(AccountSetupBasics.ACTION_RETURN_TO_CALLER, true);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
fromActivity.startActivity(i);
|
||||
}
|
||||
|
||||
public static void actionAccountCreateFinished(Activity fromActivity, long accountId) {
|
||||
Intent i= new Intent(fromActivity, AccountSetupBasics.class);
|
||||
// If we're not in the "eas flow" (from AccountManager), we want to show the message list
|
||||
// for the new inbox
|
||||
i.putExtra(AccountSetupBasics.ACTION_START_AT_MESSAGE_LIST, accountId);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
fromActivity.startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent.getBooleanExtra(ACTION_RETURN_TO_CALLER, false)) {
|
||||
// Return to the caller who initiated account creation
|
||||
finish();
|
||||
return;
|
||||
} else {
|
||||
long accountId = intent.getLongExtra(ACTION_START_AT_MESSAGE_LIST, -1);
|
||||
if (accountId >= 0) {
|
||||
// Show the message list for the new account
|
||||
MessageList.actionHandleAccount(this, accountId, Mailbox.TYPE_INBOX);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setContentView(R.layout.account_setup_basics);
|
||||
mEmailView = (EditText)findViewById(R.id.account_email);
|
||||
mPasswordView = (EditText)findViewById(R.id.account_password);
|
||||
|
@ -132,7 +176,7 @@ public class AccountSetupBasics extends Activity
|
|||
}
|
||||
}
|
||||
|
||||
mEasFlowMode = getIntent().getBooleanExtra(EXTRA_EAS_FLOW, false);
|
||||
mEasFlowMode = intent.getBooleanExtra(EXTRA_EAS_FLOW, false);
|
||||
if (mEasFlowMode) {
|
||||
// No need for manual button -> next is appropriate
|
||||
mManualSetupButton.setVisibility(View.GONE);
|
||||
|
@ -427,7 +471,6 @@ public class AccountSetupBasics extends Activity
|
|||
|
||||
AccountSetupAccountType.actionSelectAccountType(this, mAccount, mDefaultView.isChecked(),
|
||||
mEasFlowMode);
|
||||
finish();
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -18,7 +18,6 @@ package com.android.email.activity.setup;
|
|||
|
||||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.activity.MessageList;
|
||||
import com.android.email.provider.EmailContent;
|
||||
import com.android.email.provider.EmailContent.AccountColumns;
|
||||
|
||||
|
@ -84,7 +83,7 @@ public class AccountSetupNames extends Activity implements OnClickListener {
|
|||
* just leave the saved value alone.
|
||||
*/
|
||||
// mDescription.setText(mAccount.getDescription());
|
||||
if (mAccount.getSenderName() != null) {
|
||||
if (mAccount != null && mAccount.getSenderName() != null) {
|
||||
mName.setText(mAccount.getSenderName());
|
||||
}
|
||||
if (!Utility.requiredFieldValid(mName)) {
|
||||
|
@ -100,6 +99,17 @@ public class AccountSetupNames extends Activity implements OnClickListener {
|
|||
Utility.setCompoundDrawablesAlpha(mDoneButton, mDoneButton.isEnabled() ? 255 : 128);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
boolean easFlowMode = getIntent().getBooleanExtra(EXTRA_EAS_FLOW, false);
|
||||
if (easFlowMode) {
|
||||
AccountSetupBasics.actionAccountCreateFinishedEas(this);
|
||||
} else {
|
||||
AccountSetupBasics.actionAccountCreateFinished(this, mAccount.mId);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
/**
|
||||
* After having a chance to input the display names, we normally jump directly to the
|
||||
* inbox for the new account. However if we're in EAS flow mode (externally-launched
|
||||
|
@ -117,14 +127,7 @@ public class AccountSetupNames extends Activity implements OnClickListener {
|
|||
cv.put(AccountColumns.DISPLAY_NAME, mAccount.getDisplayName());
|
||||
cv.put(AccountColumns.SENDER_NAME, name);
|
||||
mAccount.update(this, cv);
|
||||
|
||||
// Exit or dispatch per flow mode
|
||||
if (getIntent().getBooleanExtra(EXTRA_EAS_FLOW, false)) {
|
||||
// do nothing - just pop off the activity stack
|
||||
} else {
|
||||
MessageList.actionHandleAccount(this, mAccount.mId, EmailContent.Mailbox.TYPE_INBOX);
|
||||
}
|
||||
finish();
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
|
|
Loading…
Reference in New Issue