am 79ef52cf: Improve handling of UI reset cases

Merge commit '79ef52cfb33e9fb2a2e71d31e0b3810ed1babea5' into froyo-plus-aosp

* commit '79ef52cfb33e9fb2a2e71d31e0b3810ed1babea5':
  Improve handling of UI reset cases
This commit is contained in:
Andrew Stadler 2010-04-14 20:32:46 -07:00 committed by Android Git Automerger
commit bd9f4ab329
2 changed files with 14 additions and 5 deletions

View File

@ -40,8 +40,14 @@ import android.os.Bundle;
*/
public class Welcome extends Activity {
/**
* Launch this activity. Note: It's assumed that this activity is only called as a means to
* 'reset' the UI state; Because of this, it is always launched with FLAG_ACTIVITY_CLEAR_TOP,
* which will drop any other activities on the stack (e.g. AccountFolderList or MessageList).
*/
public static void actionStart(Activity fromActivity) {
Intent i = new Intent(fromActivity, Welcome.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
fromActivity.startActivity(i);
}

View File

@ -94,10 +94,7 @@ public class AccountSetupNames extends Activity implements OnClickListener {
mAccount = EmailContent.Account.restoreAccountWithId(this, accountId);
// Shouldn't happen, but it could
if (mAccount == null) {
// The safe thing to do here is to rewind all the way to the entry activity,
// which can handle any configuration of accounts (0, 1, or 2+)
Welcome.actionStart(this);
finish();
onBackPressed();
return;
}
// Get the hostAuth for receiving
@ -153,7 +150,13 @@ public class AccountSetupNames extends Activity implements OnClickListener {
if (easFlowMode) {
AccountSetupBasics.actionAccountCreateFinishedEas(this);
} else {
AccountSetupBasics.actionAccountCreateFinished(this, mAccount.mId);
if (mAccount != null) {
AccountSetupBasics.actionAccountCreateFinished(this, mAccount.mId);
} else {
// Safety check here; If mAccount is null (due to external issues or bugs)
// just rewind back to Welcome, which can handle any configuration of accounts
Welcome.actionStart(this);
}
}
finish();
}