Improve handling of UI reset cases

* When account disappears (e.g. delete from Accounts & Sync) the Welcome
   activity should launch with FLAG_ACTIVITY_CLEAR_TOP to remove any
   stacked activities as well.
* When account disappears entering AccountSetupNames, don't fall out
   of Eas Flow Mode.
* Followup to 5e354cd1db

Bug: 2563998
Change-Id: Ifbe086e26205bb28c2514f84cb28e839888b1eb0
This commit is contained in:
Andrew Stadler 2010-04-14 19:16:46 -07:00
parent 694fe3b0c7
commit 79ef52cfb3
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();
}