Exemplo n.º 1
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;

    XboxLiveFriendListItem item = (XboxLiveFriendListItem) acmi.targetView;
    ViewHolder vh = (ViewHolder) acmi.targetView.getTag();
    menu.setHeaderTitle(vh.gamertag.getText());

    getActivity().getMenuInflater().inflate(R.menu.xbl_friend_list_context, menu);

    int statusCode = Friends.getStatusCode(getActivity(), item.mFriendId);

    if (statusCode == XboxLive.STATUS_INVITE_RCVD) {
      menu.setGroupVisible(R.id.menu_group_invite_rcvd, true);
      menu.setGroupVisible(R.id.menu_group_invite_sent, false);
      menu.setGroupVisible(R.id.menu_group_friend, false);
      menu.setGroupVisible(R.id.menu_group_gold, false);
    } else if (statusCode == XboxLive.STATUS_INVITE_SENT) {
      menu.setGroupVisible(R.id.menu_group_invite_rcvd, false);
      menu.setGroupVisible(R.id.menu_group_invite_sent, true);
      menu.setGroupVisible(R.id.menu_group_friend, false);
      menu.setGroupVisible(R.id.menu_group_gold, false);
    } else {
      menu.setGroupVisible(R.id.menu_group_invite_rcvd, false);
      menu.setGroupVisible(R.id.menu_group_invite_sent, false);
      menu.setGroupVisible(R.id.menu_group_friend, true);
      menu.setGroupVisible(R.id.menu_group_gold, mAccount.isGold());
    }
  }
Exemplo n.º 2
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
    ViewHolder vh = (ViewHolder) acmi.targetView.getTag();

    menu.setHeaderTitle(vh.gamertag.getText());

    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.xbl_friends_of_friend_list_context, menu);

    menu.setGroupVisible(R.id.menu_group_gold, mAccount.isGold());
    menu.setGroupVisible(R.id.menu_group_friend, false);
    menu.setGroupVisible(R.id.menu_group_nonfriend, true);
  }