Fixed issues that cause rotation to NPE
* Add the checker fragment (instead of replacing) * Don't refresh progress/error dialogs until onResume (a bit later) * Don't recreate terminal error dialogs that were automatically regenerated by the fragment manager. Bug: 3020074 Change-Id: Ia2947965b758f6846c62ac394ce51da2432523ee
This commit is contained in:
parent
2164e8bc2d
commit
f946ff0019
|
@ -159,8 +159,15 @@ public class AccountCheckSettingsFragment extends Fragment {
|
|||
new AccountCheckTask(checkMode, checkAccount)
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When resuming, restart the progress/error UI if necessary by re-reporting previous values
|
||||
*/
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// if reattaching, update progress/error UI by re-reporting the previous values
|
||||
if (mState != STATE_START) {
|
||||
reportProgress(mState, mErrorStringId, mErrorMessage, mAutoDiscoverResult);
|
||||
}
|
||||
|
@ -220,23 +227,27 @@ public class AccountCheckSettingsFragment extends Fragment {
|
|||
case STATE_CHECK_SHOW_SECURITY:
|
||||
// 1. get rid of progress dialog (if any)
|
||||
recoverAndDismissCheckingDialog();
|
||||
// 2. launch the error dialog
|
||||
SecurityRequiredDialog securityRequiredDialog =
|
||||
SecurityRequiredDialog.newInstance(this, mErrorMessage);
|
||||
fm.openTransaction()
|
||||
.add(securityRequiredDialog, SecurityRequiredDialog.TAG)
|
||||
.commit();
|
||||
// 2. launch the error dialog, if needed
|
||||
if (fm.findFragmentByTag(SecurityRequiredDialog.TAG) == null) {
|
||||
SecurityRequiredDialog securityRequiredDialog =
|
||||
SecurityRequiredDialog.newInstance(this, mErrorMessage);
|
||||
fm.openTransaction()
|
||||
.add(securityRequiredDialog, SecurityRequiredDialog.TAG)
|
||||
.commit();
|
||||
}
|
||||
break;
|
||||
case STATE_CHECK_ERROR:
|
||||
case STATE_AUTODISCOVER_AUTH_DIALOG:
|
||||
// 1. get rid of progress dialog (if any)
|
||||
recoverAndDismissCheckingDialog();
|
||||
// 2. launch the error dialog
|
||||
ErrorDialog errorDialog =
|
||||
ErrorDialog.newInstance(this, mErrorStringId, mErrorMessage);
|
||||
fm.openTransaction()
|
||||
.add(errorDialog, ErrorDialog.TAG)
|
||||
.commit();
|
||||
// 2. launch the error dialog, if needed
|
||||
if (fm.findFragmentByTag(ErrorDialog.TAG) == null) {
|
||||
ErrorDialog errorDialog =
|
||||
ErrorDialog.newInstance(this, mErrorStringId, mErrorMessage);
|
||||
fm.openTransaction()
|
||||
.add(errorDialog, ErrorDialog.TAG)
|
||||
.commit();
|
||||
}
|
||||
break;
|
||||
case STATE_AUTODISCOVER_RESULT:
|
||||
// 1. get rid of progress dialog (if any)
|
||||
|
|
|
@ -183,7 +183,7 @@ public class AccountSetupExchange extends AccountSetupActivity
|
|||
AccountCheckSettingsFragment checkerFragment =
|
||||
AccountCheckSettingsFragment.newInstance(checkMode, target);
|
||||
FragmentTransaction transaction = getFragmentManager().openTransaction();
|
||||
transaction.replace(R.id.setup_fragment, checkerFragment);
|
||||
transaction.add(checkerFragment, AccountCheckSettingsFragment.TAG);
|
||||
transaction.addToBackStack("back");
|
||||
transaction.commit();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class AccountSetupIncoming extends AccountSetupActivity
|
|||
AccountCheckSettingsFragment checkerFragment =
|
||||
AccountCheckSettingsFragment.newInstance(checkMode, target);
|
||||
FragmentTransaction transaction = getFragmentManager().openTransaction();
|
||||
transaction.replace(R.id.setup_fragment, checkerFragment);
|
||||
transaction.add(checkerFragment, AccountCheckSettingsFragment.TAG);
|
||||
transaction.addToBackStack("back");
|
||||
transaction.commit();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class AccountSetupOutgoing extends Activity
|
|||
AccountCheckSettingsFragment checkerFragment =
|
||||
AccountCheckSettingsFragment.newInstance(checkMode, target);
|
||||
FragmentTransaction transaction = getFragmentManager().openTransaction();
|
||||
transaction.replace(R.id.setup_fragment, checkerFragment);
|
||||
transaction.add(checkerFragment, AccountCheckSettingsFragment.TAG);
|
||||
transaction.addToBackStack("back");
|
||||
transaction.commit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue