Search in sources :

Example 6 with Email

use of org.thoughtcrime.securesms.contactshare.Contact.Email in project Signal-Android by signalapp.

the class SharedContactRepository method getEmails.

@WorkerThread
@NonNull
private List<Email> getEmails(long contactId) {
    List<Email> emails = new LinkedList<>();
    try (Cursor cursor = contactsDatabase.getEmailDetails(contactId)) {
        while (cursor != null && cursor.moveToNext()) {
            String cursorEmail = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Email.ADDRESS));
            int cursorType = cursor.getInt(cursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Email.TYPE));
            String cursorLabel = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Email.LABEL));
            emails.add(new Email(cursorEmail, VCardUtil.emailTypeFromContactType(cursorType), cursorLabel));
        }
    }
    return emails;
}
Also used : Email(org.thoughtcrime.securesms.contactshare.Contact.Email) Cursor(android.database.Cursor) LinkedList(java.util.LinkedList) WorkerThread(androidx.annotation.WorkerThread) NonNull(androidx.annotation.NonNull)

Aggregations

Email (org.thoughtcrime.securesms.contactshare.Contact.Email)6 LinkedList (java.util.LinkedList)4 Name (org.thoughtcrime.securesms.contactshare.Contact.Name)4 Phone (org.thoughtcrime.securesms.contactshare.Contact.Phone)4 PostalAddress (org.thoughtcrime.securesms.contactshare.Contact.PostalAddress)4 SharedContact (org.whispersystems.signalservice.api.messages.shared.SharedContact)4 Cursor (android.database.Cursor)2 NonNull (androidx.annotation.NonNull)2 WorkerThread (androidx.annotation.WorkerThread)2 ArrayList (java.util.ArrayList)2 Attachment (org.thoughtcrime.securesms.attachments.Attachment)2 PointerAttachment (org.thoughtcrime.securesms.attachments.PointerAttachment)2 Avatar (org.thoughtcrime.securesms.contactshare.Contact.Avatar)2