예제 #1
0
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   super.onPrepareOptionsMenu(menu);
   Log.v("start", "menu");
   removeNote = false;
   Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.container);
   if (currentFragment instanceof IndexFragment) {
     menu.findItem(R.id.action_add).setVisible(true);
     setTitle("Twoje notatki:");
   } else if (currentFragment instanceof PrivateListFragment) {
     titleSubtitle.setVisibility(View.GONE);
     menu.findItem(R.id.action_add).setVisible(true);
     menu.findItem(R.id.action_remove).setVisible(true);
     menu.findItem(R.id.action_delete).setVisible(true);
   } else if (currentFragment instanceof NoteFragment) {
     titleSubtitle.setVisibility(View.GONE);
     menu.findItem(R.id.action_delete).setVisible(true);
   } else {
     titleSubtitle.setVisibility(View.VISIBLE);
     menu.findItem(R.id.action_add).setVisible(true);
     menu.findItem(R.id.action_remove).setVisible(true);
     menu.findItem(R.id.action_reload).setVisible(true);
     menu.findItem(R.id.action_save).setVisible(true);
   }
   return true;
 }
예제 #2
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem item = menu.findItem(R.id.action_sending);
    ParseUser currentUser = ParseUser.getCurrentUser();
    String[] list = getResources().getStringArray(R.array.admin_mail_address);
    item.setVisible(false);
    if (currentUser != null) {
      Log.e("Name", currentUser.getUsername());
      Log.e("Name", currentUser.getEmail());

    } else {
      Log.e("NULL USER", "NOT LOGGED IN");
    }
    if (currentUser != null) {
      for (String s : list) {
        if (currentUser.getEmail().equals(s)) {
          item.setVisible(true);
          Log.e("Vis", "TRUE");
          break;
        }
      }
    }
    super.onPrepareOptionsMenu(menu);
    return true;
  }
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   super.onPrepareOptionsMenu(menu);
   mOptionsMenu = menu;
   // if(mPendingMenuRefreshState!=null) setRefreshActionButtonState(mPendingMenuRefreshState);
   updateRefreshActionButtonState();
   updateUserHeader();
   return true;
 }
예제 #4
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    Broadcast broadcast = mBroadcastAdapter.getBroadcast();
    boolean hasBroadcast = broadcast != null;
    menu.findItem(R.id.action_copy_text).setVisible(hasBroadcast);
    boolean canDelete = hasBroadcast && broadcast.author.id == AccountUtils.getUserId(this);
    menu.findItem(R.id.action_delete).setVisible(canDelete);
    return true;
  }