RecipientEntrypublic class RecipientEntry extends Object Represents one entry inside recipient auto-complete list. |
Fields Summary |
---|
static final int | INVALID_CONTACT | static final int | GENERATED_CONTACTA GENERATED_CONTACT is one that was created based entirely on
information passed in to the RecipientEntry from an external source
that is not a real contact. | public static final int | INVALID_DESTINATION_TYPEUsed when {@link #mDestinationType} is invalid and thus shouldn't be used for display. | public static final int | ENTRY_TYPE_PERSON | public static final int | ENTRY_TYPE_SIZE | private final int | mEntryType | private boolean | mIsFirstLevelTrue when this entry is the first entry in a group, which should have a photo and display
name, while the second or later entries won't. | private final String | mDisplayName | private final String | mDestinationDestination for this contact entry. Would be an email address or a phone number. | private final int | mDestinationTypeType of the destination like {@link Email#TYPE_HOME} | private final String | mDestinationLabelLabel of the destination which will be used when type was {@link Email#TYPE_CUSTOM}.
Can be null when {@link #mDestinationType} is {@link #INVALID_DESTINATION_TYPE}. | private final long | mContactIdID for the person | private final Long | mDirectoryIdID for the directory this contact came from, or null | private final long | mDataIdID for the destination | private final boolean | mIsDivider | private final android.net.Uri | mPhotoThumbnailUri | private boolean | mIsValid | private byte[] | mPhotoBytesThis can be updated after this object being constructed, when the photo is fetched
from remote directories. | private final String | mLookupKeySee {@link android.provider.ContactsContract.ContactsColumns#LOOKUP_KEY} |
Constructors Summary |
---|
protected RecipientEntry(int entryType, String displayName, String destination, int destinationType, String destinationLabel, long contactId, Long directoryId, long dataId, android.net.Uri photoThumbnailUri, boolean isFirstLevel, boolean isValid, String lookupKey)
mEntryType = entryType;
mIsFirstLevel = isFirstLevel;
mDisplayName = displayName;
mDestination = destination;
mDestinationType = destinationType;
mDestinationLabel = destinationLabel;
mContactId = contactId;
mDirectoryId = directoryId;
mDataId = dataId;
mPhotoThumbnailUri = photoThumbnailUri;
mPhotoBytes = null;
mIsDivider = false;
mIsValid = isValid;
mLookupKey = lookupKey;
|
Methods Summary |
---|
public static com.android.ex.chips.RecipientEntry | constructFakeEntry(java.lang.String address, boolean isValid)Construct a RecipientEntry from just an address that has been entered.
This address has not been resolved to a contact and therefore does not
have a contact id or photo.
final Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(address);
final String tokenizedAddress = tokens.length > 0 ? tokens[0].getAddress() : address;
return new RecipientEntry(ENTRY_TYPE_PERSON, tokenizedAddress, tokenizedAddress,
INVALID_DESTINATION_TYPE, null, INVALID_CONTACT, null /* directoryId */,
INVALID_CONTACT, null, true, isValid, null /* lookupKey */);
| public static com.android.ex.chips.RecipientEntry | constructFakePhoneEntry(java.lang.String phoneNumber, boolean isValid)Construct a RecipientEntry from just a phone number.
return new RecipientEntry(ENTRY_TYPE_PERSON, phoneNumber, phoneNumber,
INVALID_DESTINATION_TYPE, null, INVALID_CONTACT, null /* directoryId */,
INVALID_CONTACT, null, true, isValid, null /* lookupKey */);
| public static com.android.ex.chips.RecipientEntry | constructGeneratedEntry(java.lang.String display, java.lang.String address, boolean isValid)Construct a RecipientEntry from just an address that has been entered
with both an associated display name. This address has not been resolved
to a contact and therefore does not have a contact id or photo.
return new RecipientEntry(ENTRY_TYPE_PERSON, display, address, INVALID_DESTINATION_TYPE,
null, GENERATED_CONTACT, null /* directoryId */, GENERATED_CONTACT, null, true,
isValid, null /* lookupKey */);
| public static com.android.ex.chips.RecipientEntry | constructSecondLevelEntry(java.lang.String displayName, int displayNameSource, java.lang.String destination, int destinationType, java.lang.String destinationLabel, long contactId, java.lang.Long directoryId, long dataId, java.lang.String thumbnailUriAsString, boolean isValid, java.lang.String lookupKey)
return new RecipientEntry(ENTRY_TYPE_PERSON, pickDisplayName(displayNameSource,
displayName, destination), destination, destinationType, destinationLabel,
contactId, directoryId, dataId, (thumbnailUriAsString != null
? Uri.parse(thumbnailUriAsString) : null), false, isValid, lookupKey);
| public static com.android.ex.chips.RecipientEntry | constructTopLevelEntry(java.lang.String displayName, int displayNameSource, java.lang.String destination, int destinationType, java.lang.String destinationLabel, long contactId, java.lang.Long directoryId, long dataId, android.net.Uri photoThumbnailUri, boolean isValid, java.lang.String lookupKey)
return new RecipientEntry(ENTRY_TYPE_PERSON, pickDisplayName(displayNameSource,
displayName, destination), destination, destinationType, destinationLabel,
contactId, directoryId, dataId, photoThumbnailUri, true, isValid, lookupKey);
| public static com.android.ex.chips.RecipientEntry | constructTopLevelEntry(java.lang.String displayName, int displayNameSource, java.lang.String destination, int destinationType, java.lang.String destinationLabel, long contactId, java.lang.Long directoryId, long dataId, java.lang.String thumbnailUriAsString, boolean isValid, java.lang.String lookupKey)
return new RecipientEntry(ENTRY_TYPE_PERSON, pickDisplayName(displayNameSource,
displayName, destination), destination, destinationType, destinationLabel,
contactId, directoryId, dataId, (thumbnailUriAsString != null
? Uri.parse(thumbnailUriAsString) : null), true, isValid, lookupKey);
| public long | getContactId()
return mContactId;
| public long | getDataId()
return mDataId;
| public java.lang.String | getDestination()
return mDestination;
| public java.lang.String | getDestinationLabel()
return mDestinationLabel;
| public int | getDestinationType()
return mDestinationType;
| public java.lang.Long | getDirectoryId()
return mDirectoryId;
| public java.lang.String | getDisplayName()
return mDisplayName;
| public int | getEntryType()
return mEntryType;
| public java.lang.String | getLookupKey()
return mLookupKey;
| public synchronized byte[] | getPhotoBytes()This can be called outside main Looper thread.
return mPhotoBytes;
| public android.net.Uri | getPhotoThumbnailUri()
return mPhotoThumbnailUri;
| public static boolean | isCreatedRecipient(long id)Determine if this was a RecipientEntry created from recipient info or
an entry from contacts.
return id == RecipientEntry.INVALID_CONTACT || id == RecipientEntry.GENERATED_CONTACT;
| public boolean | isFirstLevel()
return mIsFirstLevel;
| public boolean | isSamePerson(com.android.ex.chips.RecipientEntry entry)Returns if entry represents the same person as this instance. The default implementation
checks whether the contact ids are the same, and subclasses may opt to override this.
return entry != null && mContactId == entry.mContactId;
| public boolean | isSelectable()
return mEntryType == ENTRY_TYPE_PERSON;
| public boolean | isSeparator()
return mIsDivider;
| public boolean | isValid()
return mIsValid;
| private static java.lang.String | pickDisplayName(int displayNameSource, java.lang.String displayName, java.lang.String destination)
return (displayNameSource > DisplayNameSources.PHONE) ? displayName : destination;
| public synchronized void | setPhotoBytes(byte[] photoBytes)This can be called outside main Looper thread.
mPhotoBytes = photoBytes;
| public java.lang.String | toString()
return mDisplayName + " <" + mDestination + ">, isValid=" + mIsValid;
|
|