@Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    if (this.mDrawerLayout != null && this.mDrawerList != null) {
      for (int i = 0; i < menu.size(); i++) {
        MenuItem item = menu.getItem(i);
        item.setVisible(!mDrawerLayout.isDrawerOpen(mDrawerList));
      }
    }

    return super.onPrepareOptionsMenu(menu);
  }
  @Override
  public void onPrepareOptionsMenu(Menu menu) {
    for (int index = 0; index < menu.size(); index++) {
      menu.getItem(index).setVisible(false);
    }

    getSherlockActivity().getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSherlockActivity().getSupportActionBar().setTitle(actionBarTitle);
    getSherlockActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(false);

    super.onPrepareOptionsMenu(menu);
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * com.actionbarsherlock.app.SherlockListFragment#onCreateOptionsMenu(android
  * .view.Menu, android.view.MenuInflater)
  */
 @Override
 public void onCreateOptionsMenu(
     com.actionbarsherlock.view.Menu menu, com.actionbarsherlock.view.MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.channel_list, menu);
   for (int i = 0; i < menu.size(); i++) {
     if (menu.getItem(i).getItemId() == R.id.menuChannelList) {
       menu.getItem(i).setVisible(showFavs);
     } else if (menu.getItem(i).getItemId() == R.id.menuFavourties) {
       menu.getItem(i).setVisible(!showFavs);
     }
   }
   menu.findItem(R.id.menuChannelList).setVisible(showFavs);
   menu.findItem(R.id.menuFavourties).setVisible(!showFavs);
   if (getSherlockActivity() instanceof ChannelListMultiActivity) {
     menu.findItem(R.id.menu_refresh_now_playing).setVisible(false);
     menu.findItem(R.id.menuRefreshChannels).setVisible(false);
   }
 }
Exemple #4
0
 private void toggleActionsState(Menu menu, boolean state) {
   for (int i = 0; i < menu.size(); ++i) {
     menu.getItem(i).setEnabled(state);
   }
 }