Port I96aa59a4c13310d8d63b4476990682d08b5bc772 to jb-ub-mail

Bug: 6601778

Change-Id: I0f8a474746eb2151f1f2777fbb405c159558614f
This commit is contained in:
Marc Blank 2012-06-04 11:53:06 -07:00
parent 8410a296c5
commit 71018513b2
1 changed files with 19 additions and 3 deletions

View File

@ -78,6 +78,7 @@ public class AccountCheckSettingsFragment extends Fragment {
// Support for UI
private boolean mAttached;
private boolean mPaused = false;
private CheckingDialog mCheckingDialog;
private MessagingException mProgressException;
@ -168,12 +169,19 @@ public class AccountCheckSettingsFragment extends Fragment {
@Override
public void onResume() {
super.onResume();
mPaused = false;
if (mState != STATE_START) {
reportProgress(mState, mProgressException);
}
}
@Override
public void onPause() {
super.onPause();
mPaused = true;
}
/**
* This is called when the fragment is going away. It is NOT called
* when the fragment is being propagated between activity instances.
@ -181,8 +189,10 @@ public class AccountCheckSettingsFragment extends Fragment {
@Override
public void onDestroy() {
super.onDestroy();
Utility.cancelTaskInterrupt(mAccountCheckTask);
mAccountCheckTask = null;
if (mAccountCheckTask != null) {
Utility.cancelTaskInterrupt(mAccountCheckTask);
mAccountCheckTask = null;
}
}
/**
@ -206,7 +216,7 @@ public class AccountCheckSettingsFragment extends Fragment {
mProgressException = ex;
// If we are attached, create, recover, and/or update the dialog
if (mAttached) {
if (mAttached && !mPaused) {
FragmentManager fm = getFragmentManager();
switch (newState) {
@ -731,6 +741,7 @@ public class AccountCheckSettingsFragment extends Fragment {
dialog.setButton(DialogInterface.BUTTON_NEGATIVE,
context.getString(R.string.cancel_action),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
target.onCheckingDialogCancel();
@ -828,6 +839,7 @@ public class AccountCheckSettingsFragment extends Fragment {
builder.setPositiveButton(
context.getString(android.R.string.ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
target.onEditCertificateOk();
@ -836,6 +848,7 @@ public class AccountCheckSettingsFragment extends Fragment {
builder.setNegativeButton(
context.getString(android.R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
target.onErrorDialogEditButton();
@ -847,6 +860,7 @@ public class AccountCheckSettingsFragment extends Fragment {
builder.setPositiveButton(
context.getString(R.string.account_setup_failed_dlg_edit_details_action),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
target.onErrorDialogEditButton();
@ -903,6 +917,7 @@ public class AccountCheckSettingsFragment extends Fragment {
.setPositiveButton(
context.getString(R.string.okay_action),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
target.onSecurityRequiredDialogResultOk(true);
@ -911,6 +926,7 @@ public class AccountCheckSettingsFragment extends Fragment {
.setNegativeButton(
context.getString(R.string.cancel_action),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
target.onSecurityRequiredDialogResultOk(false);