Refresh account list in settings.
Since account deletion is async, the deleted account still shows up for a split second. We can do something smarter about this later, but not for ICS, and not worth it for such a rare event Bug: 5116203 Change-Id: I82cced09b7a098e4a1a960f2d8ad75c1979b0649
This commit is contained in:
parent
f97ec4d1e8
commit
b7d137bfb6
|
@ -26,6 +26,7 @@ import android.content.Context;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -112,6 +113,7 @@ public class AccountSettings extends PreferenceActivity {
|
|||
// Async Tasks
|
||||
private LoadAccountListTask mLoadAccountListTask;
|
||||
private GetAccountIdFromAccountTask mGetAccountIdFromAccountTask;
|
||||
private ContentObserver mAccountObserver;
|
||||
|
||||
// Specific callbacks used by settings fragments
|
||||
private final AccountSettingsFragmentCallback mAccountSettingsFragmentCallback
|
||||
|
@ -187,14 +189,28 @@ public class AccountSettings extends PreferenceActivity {
|
|||
|
||||
getActionBar().setDisplayOptions(
|
||||
ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
|
||||
|
||||
mAccountObserver = new ContentObserver(Utility.getMainThreadHandler()) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
updateAccounts();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getContentResolver().registerContentObserver(Account.NOTIFIER_URI, true, mAccountObserver);
|
||||
updateAccounts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
getContentResolver().unregisterContentObserver(mAccountObserver);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
|
Loading…
Reference in New Issue