Package com.tomtom.ivi.platform.contacts.api.common.util

The com.tomtom.ivi.platform.contacts.api.common.util package contains useful helper classes that can be used to simplify working with features provided by the contacts service. This package can be used for implementing a custom contacts service or in a frontend using the contacts service.

External links

  • Contacts service.

Types

Link copied to clipboard

Properties

Link copied to clipboard
val Contact.contactGroup: String

Returns the contact group of the given contact. For contacts with western-European names, this is typically the first letter of the primary sort key of the contact. Contacts whose primary sort key does not start with a letter or language character are put into the group MISCELLANEOUS_CONTACT_GROUP. For example, a contact whose primary sort key starts with "5" or ">" or "-" are part of this group.

Link copied to clipboard
const val MISCELLANEOUS_CONTACT_GROUP: String

Represents the miscellaneous contact group. Contacts whose primary sort key does not start with a human language letter or character are part of this group. See also Contact.contactGroup for more details.

Functions

Link copied to clipboard
fun comparePhoneNumbers(phoneNumber1: String, phoneNumber2: String): Boolean

Compare phone numbers phoneNumber1 and phoneNumber2, return true if they're identical enough for caller ID purposes.

Link copied to clipboard
fun contactNameStringResolver(    displayName: String?,     phoneNumber: String?,     @StringRes unknownContact: Int): StringResolver

Returns a StringResolver with the following priority order:

Link copied to clipboard
fun LiveData<IviContactsDataSource>.findContactByContactId(contactId: LiveData<ContactId?>, queryFlags: EnumSet<ContactsDataSourceQuery.ContactQueryFlags> = EnumSet.noneOf(ContactQueryFlags::class.java)): LiveData<Contact?>

Finds a contact with the specified contactId. Flags from ContactQueryFlags can be set in queryFlags to refine how the results should be returned. See ContactQueryFlags for available flags.

Link copied to clipboard
fun Collection<Contact>.findContactByName(displayName: String): Contact?

Finds a contact with the specified displayName.

Link copied to clipboard
fun Collection<Contact>.findContactByNameAndPhoneNumber(displayName: String, phoneNumber: String): Contact?

Finds a contact with the specified displayName and phoneNumber.

Link copied to clipboard
fun Collection<Contact>.findContactByPhoneNumber(phoneNumber: String): Contact?

Finds a contact with the specified phoneNumber.

fun LiveData<IviContactsDataSource>.findContactByPhoneNumber(phoneNumber: LiveData<String?>, queryFlags: EnumSet<ContactsDataSourceQuery.ContactQueryFlags> = EnumSet.noneOf(ContactQueryFlags::class.java)): LiveData<Contact?>

Finds a contact with the specified phoneNumber. Flags from ContactQueryFlags can be set in queryFlags to refine how the results should be returned. See ContactQueryFlags for available flags.

Link copied to clipboard
fun LiveData<IviContactsDataSource>.findContactsByDisplayNames(displayNames: Set<String>): LiveData<List<Contact>>

Returns a list of the first matching Contacts with the specified displayNames. An empty list is returned if no contact can be found with a matching display name.

Link copied to clipboard
fun Collection<PhoneNumber>.findPhoneNumber(number: String): PhoneNumber?

Find the first PhoneNumber matching the specified number or return null if it cannot be found in this collection.

Link copied to clipboard
fun AddressType.getLabel(): StringResolver

Retrieves the AddressType as string represented by StringResolver from the resources.

fun PhoneNumberType.getLabel(): StringResolver

Retrieve the PhoneNumberType as a StringResolver. Strings are provided by Android resources except for the PhoneNumberType.Custom type which is provided by PhoneNumberType.customType.

Link copied to clipboard

Launches a query that returns the full list of Contacts ordered by the provided order.

Link copied to clipboard
fun LiveData<IviContactsDataSource>.queryHasContacts(): LiveData<Boolean>

Launches a query that returns the LiveData indicator of whether the source is empty.

Link copied to clipboard
fun List<Contact>.toContactItems(flags: EnumSet<ContactsDataSourceQuery.ContactQueryFlags> = EnumSet.noneOf(ContactQueryFlags::class.java)): List<ContactsDataSourceElement.ContactItem>

Converts a list of Contacts to a list of ContactItems.