@Override public View getView(int position, View convertView, ViewGroup parent) { View result; if (convertView == null) { result = mLayoutInflater.inflate( mIsGroupMembershipEditable ? R.layout.group_member_item : R.layout.external_group_member_item, parent, false); } else { result = convertView; } final Member member = getItem(position); QuickContactBadge badge = (QuickContactBadge) result.findViewById(R.id.badge); badge.assignContactUri(member.getLookupUri()); TextView name = (TextView) result.findViewById(R.id.name); name.setText(member.getDisplayName()); View deleteButton = result.findViewById(R.id.delete_button_container); if (deleteButton != null) { deleteButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { removeMember(member); } }); } DefaultImageRequest request = new DefaultImageRequest( member.getDisplayName(), member.getLookupKey(), true /* isCircular */); mPhotoManager.loadPhoto( badge, member.getPhotoUri(), ViewUtil.getConstantPreLayoutWidth(badge), false, true /* isCircular */, request); return result; }
@Override protected int getApproximateImageSize() { return ViewUtil.getConstantPreLayoutWidth(getPhotoView()); }