am 9f0bab9b: Merge "Close account settings if there\'s no account to show" into lmp-mr1-dev

* commit '9f0bab9bcb756607da99758971207ad833c4608b':
  Close account settings if there's no account to show
This commit is contained in:
Alexandra Gherghina
2014-10-28 15:35:36 +00:00
committed by Android Git Automerger

View File

@@ -99,8 +99,8 @@ public class ManageAccountsSettings extends AccountPreferenceBase
} }
@Override @Override
public void onStart() { public void onResume() {
super.onStart(); super.onResume();
mAuthenticatorHelper.listenToAccountUpdates(); mAuthenticatorHelper.listenToAccountUpdates();
updateAuthDescriptions(); updateAuthDescriptions();
showAccountsIfNeeded(); showAccountsIfNeeded();
@@ -133,11 +133,16 @@ public class ManageAccountsSettings extends AccountPreferenceBase
} }
} }
@Override
public void onPause() {
super.onPause();
mAuthenticatorHelper.stopListeningToAccountUpdates();
}
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
final Activity activity = getActivity(); final Activity activity = getActivity();
mAuthenticatorHelper.stopListeningToAccountUpdates();
activity.getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_CUSTOM); activity.getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_CUSTOM);
activity.getActionBar().setCustomView(null); activity.getActionBar().setCustomView(null);
} }
@@ -231,7 +236,7 @@ public class ManageAccountsSettings extends AccountPreferenceBase
private void showSyncState() { private void showSyncState() {
// Catch any delayed delivery of update messages // Catch any delayed delivery of update messages
if (getActivity() == null) return; if (getActivity() == null || getActivity().isFinishing()) return;
final int userId = mUserHandle.getIdentifier(); final int userId = mUserHandle.getIdentifier();
@@ -377,10 +382,8 @@ public class ManageAccountsSettings extends AccountPreferenceBase
if (mAccountType != null && mFirstAccount != null) { if (mAccountType != null && mFirstAccount != null) {
addAuthenticatorSettings(); addAuthenticatorSettings();
} else { } else {
// There's no account, reset to top-level of settings // There's no account, close activity
Intent settingsTop = new Intent(android.provider.Settings.ACTION_SETTINGS); finish();
settingsTop.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getActivity().startActivity(settingsTop);
} }
} }