@Override
 public View getView(int position, View convertView, ViewGroup parent) {
   Object o = getItem(position);
   if (o instanceof EmailContact) {
     EmailContact contact = (EmailContact) o;
     EmailContactListItem item;
     if ((convertView != null) && (convertView instanceof EmailContactListItem)) {
       item = (EmailContactListItem) convertView;
       item.setTitleVisibility(View.VISIBLE);
     } else {
       item = new EmailContactListItem(parent.getContext());
     }
     if (position > 0) {
       Object previousObject = getItem(position - 1);
       if (previousObject instanceof Contact) {
         Contact previousContact = (Contact) previousObject;
         if (!TextUtils.isEmpty(previousContact.getLookupKey())
             && TextUtils.equals(previousContact.getLookupKey(), contact.getLookupKey())) {
           item.setTitleVisibility(View.GONE);
         }
       }
     }
     item.setContact(contact);
     return item;
   }
   return super.getView(position, convertView, parent);
 }
Ejemplo n.º 2
0
 public static InternetAddress getInternetAddress(EmailContact emailContact)
     throws SeamMailException {
   try {
     return new InternetAddress(
         emailContact.getEmailAddress(), emailContact.getName(), emailContact.getCharset());
   } catch (UnsupportedEncodingException e) {
     throw new SeamMailException("Unable convert recipient to InternetAddress", e);
   }
 }