コード例 #1
0
  @Override
  public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    MenuItem mentionItem = menu.findItem(R.id.mention);
    MenuItem createItem = menu.findItem(R.id.create);
    MenuItem destoryItem = menu.findItem(R.id.destory);
    MenuItem followerDestoryItem = menu.findItem(R.id.followDestory);

    if (mUser == null || AppContext.getUser().getIdstr().equals(mUser.getIdstr())) {
      mentionItem.setVisible(false);
      createItem.setVisible(false);
      destoryItem.setVisible(false);
      followerDestoryItem.setVisible(false);
    } else {
      mentionItem.setVisible(true);

      createItem.setVisible(mFriendship != null && !mFriendship.getSource().getFollowing());
      destoryItem.setVisible(mFriendship != null && mFriendship.getSource().getFollowing());

      followerDestoryItem.setVisible(mFriendship != null && mFriendship.getTarget().getFollowing());
    }
  }
コード例 #2
0
  @Override
  public void onDestoryFollower(WeiBoUser user) {
    if (mFriendship != null) mFriendship.getTarget().setFollowing(false);

    getActivity().invalidateOptionsMenu();
  }