コード例 #1
0
 @Override
 public void onAccountsUpdated(Account[] accounts) {
   // TODO: watch for package upgrades to invalidate cache; see 7206643
   mAuthenticatorHelper.updateAuthDescriptions(this);
   mAuthenticatorHelper.onAccountsUpdated(this, accounts);
   invalidateHeaders();
 }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    if (getIntent().getBooleanExtra(EXTRA_CLEAR_UI_OPTIONS, false)) {
      getWindow().setUiOptions(0);
    }

    mAuthenticatorHelper = new AuthenticatorHelper();
    mAuthenticatorHelper.updateAuthDescriptions(this);
    mAuthenticatorHelper.onAccountsUpdated(this, null);

    mDevelopmentPreferences =
        getSharedPreferences(DevelopmentSettings.PREF_FILE, Context.MODE_PRIVATE);

    getMetaData();
    mInLocalHeaderSwitch = true;
    super.onCreate(savedInstanceState);
    mInLocalHeaderSwitch = false;

    if (!onIsHidingHeaders() && onIsMultiPane()) {
      highlightHeader(mTopLevelHeaderId);
      // Force the title so that it doesn't get overridden by a direct launch of
      // a specific settings screen.
      setTitle(R.string.settings_label);
    }

    // Retrieve any saved state
    if (savedInstanceState != null) {
      mCurrentHeader = savedInstanceState.getParcelable(SAVE_KEY_CURRENT_HEADER);
      mParentHeader = savedInstanceState.getParcelable(SAVE_KEY_PARENT_HEADER);
    }

    // If the current header was saved, switch to it
    if (savedInstanceState != null && mCurrentHeader != null) {
      // switchToHeaderLocal(mCurrentHeader);
      showBreadCrumbs(mCurrentHeader.title, null);
    }

    if (mParentHeader != null) {
      setParentTitle(
          mParentHeader.title,
          null,
          new OnClickListener() {
            public void onClick(View v) {
              switchToParent(mParentHeader.fragment);
            }
          });
    }

    // Override up navigation for multi-pane, since we handle it in the fragment breadcrumbs
    if (onIsMultiPane()) {
      getActionBar().setDisplayHomeAsUpEnabled(false);
      getActionBar().setHomeButtonEnabled(false);
    }
  }