Reset state when we error out of certain actions

b/13249204

Change-Id: I8312d913d5a14bfd7e02f35393cc071ba66225d1
This commit is contained in:
Tony Mantler 2014-02-28 15:56:25 -08:00
parent b2df479d06
commit 34eac10a11
1 changed files with 17 additions and 3 deletions

View File

@ -478,6 +478,16 @@ public class AccountSetupFinal extends AccountSetupActivity
return (AccountSetupFragment) getFragmentManager().findFragmentByTag(CONTENT_FRAGMENT_TAG);
}
/**
* Reads the flow state saved into the current fragment and restores mState to it, also
* resetting the headline at the same time.
*/
private void resetStateFromCurrentFragment() {
AccountSetupFragment f = getContentFragment();
mState = f.getState();
updateHeadline();
}
/**
* Main choreography function to handle moving forward through scenes. Moving back should be
* generally handled for us by the back stack
@ -613,9 +623,7 @@ public class AccountSetupFinal extends AccountSetupActivity
}
// After super.onBackPressed() our fragment should be in place, so query the state we
// installed it for
AccountSetupFragment f = getContentFragment();
mState = f.getState();
updateHeadline();
resetStateFromCurrentFragment();
}
@Override
@ -867,6 +875,8 @@ public class AccountSetupFinal extends AccountSetupActivity
if (mState == STATE_CHECKING_PRECONFIGURED) {
mPreConfiguredFailed = true;
proceed();
} else {
resetStateFromCurrentFragment();
}
final AccountSetupIncomingFragment f = (AccountSetupIncomingFragment) getContentFragment();
f.onCertificateRequested();
@ -879,6 +889,8 @@ public class AccountSetupFinal extends AccountSetupActivity
if (mState == STATE_CHECKING_PRECONFIGURED || mState == STATE_AUTO_DISCOVER) {
mPreConfiguredFailed = true;
proceed();
} else {
resetStateFromCurrentFragment();
}
}
@ -905,6 +917,8 @@ public class AccountSetupFinal extends AccountSetupActivity
public void onSecurityRequiredDialogResult(boolean ok) {
if (ok) {
proceed();
} else {
resetStateFromCurrentFragment();
}
}