Esempio n. 1
0
  @Override
  public boolean filter(AbsContactItem item) {
    if (item instanceof ContactItem) {
      IContact contact = ((ContactItem) item).getContact();
      boolean contains = ids.contains(contact.getContactId());
      return exclude ? contains : !contains;
    }

    return false;
  }
  @Override
  public void refresh(ContactDataAdapter adapter, int position, final ContactItem item) {
    // contact info
    final IContact contact = item.getContact();
    if (contact.getContactType() == IContact.Type.Friend) {
      head.loadBuddyAvatar(contact.getContactId());
    } else {
      Team team = TeamDataCache.getInstance().getTeamById(contact.getContactId());
      head.loadTeamIconByTeam(team);
    }
    name.setText(contact.getDisplayName());
    headLayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (contact.getContactType() == IContact.Type.Friend) {
              if (NimUIKit.getContactEventListener() != null) {
                NimUIKit.getContactEventListener()
                    .onAvatarClick(context, item.getContact().getContactId());
              }
            }
          }
        });

    // query result
    desc.setVisibility(View.GONE);
    /*
    TextQuery query = adapter.getQuery();
    HitInfo hitInfo = query != null ? ContactSearch.hitInfo(contact, query) : null;
    if (hitInfo != null && !hitInfo.text.equals(contact.getDisplayName())) {
        desc.setVisibility(View.VISIBLE);
    } else {
        desc.setVisibility(View.GONE);
    }
    */
  }