Пример #1
0
  protected void recreateSpinner() {
    if (currentFragment == null || currentFragment.getTitle() == null) {
      return;
    }
    if (spinnerAdapter == null || getSupportActionBar().getCustomView() == null) {
      createCustomActionBarView();
    }

    if (backStack.size() > 0) {
      createCustomActionBarView();
      spinnerAdapter.clear();
      for (int i = 0; i < backStack.size(); i++) {
        CharSequence title = backStack.get(i).getTitle();
        if (title != null) {
          spinnerAdapter.add(title);
        } else {
          spinnerAdapter.add("null");
        }
      }
      if (currentFragment.getTitle() != null) {
        spinnerAdapter.add(currentFragment.getTitle());
      } else {
        spinnerAdapter.add("null");
      }
      spinnerAdapter.notifyDataSetChanged();
      actionBarSpinner.setSelection(spinnerAdapter.getCount() - 1);
      if (!isTv()) {
        getSupportActionBar().setDisplayShowCustomEnabled(true);
      }

      if (drawerToggle.isDrawerIndicatorEnabled()) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        drawerToggle.setDrawerIndicatorEnabled(false);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      }
    } else if (!isTv()) {
      getSupportActionBar().setTitle(currentFragment.getTitle());
      getSupportActionBar().setDisplayShowCustomEnabled(false);
      drawerToggle.setDrawerIndicatorEnabled(true);
    }
  }
Пример #2
0
 public boolean isDrawerIndicatorEnabled() {
   return mDrawerToggle.isDrawerIndicatorEnabled();
 }