π¨βπ»
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| launch { | |
| val contacts = Contacts(context) | |
| .queryWithPermission() | |
| ... | |
| .findWithContext() | |
| val deferredResult = Contacts(context) | |
| .insertWithPermission() | |
| ... | |
| .commitAsync() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Contacts(context) | |
| .delete() | |
| .contacts(johnDoe) | |
| .commit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Contacts(context) | |
| .update() | |
| .contacts(johnDoe.mutableCopy { | |
| setOrganization { | |
| company = "Microsoft" | |
| title = "Newb" | |
| } | |
| emails().first().apply { | |
| address = "[email protected]" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val insertResult = Contacts(context) | |
| .insert() | |
| .rawContact { | |
| setName { | |
| givenName = "John" | |
| familyName = "Doe" | |
| } | |
| setOrganization { | |
| company = "Amazon" | |
| title = "Superstar" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val insertResult = Contacts(context) | |
| .insert() | |
| .rawContacts(NewRawContact().apply { | |
| name = NewName().apply { | |
| givenName = "John" | |
| familyName = "Doe" | |
| } | |
| organization = NewOrganization().apply { | |
| company = "Amazon" | |
| title = "Superstar" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val emails = Contacts(context).data() | |
| .query() | |
| .emails() | |
| .where(Fields.Email.Address endsWith "gmail.com") | |
| .orderBy(Fields.Email.Address.desc(ignoreCase = true)) | |
| .offset(0) | |
| .limit(20) | |
| .find() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Log.d( | |
| "Contacts", | |
| contacts.joinToString("\n\n") { contact -> | |
| """ | |
| ID: ${contact.id} | |
| Display name: ${contact.displayNamePrimary} | |
| Display name alt: ${contact.displayNameAlt} | |
| Photo Uri: ${contact.photoUri} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val contacts = Contacts(context) | |
| .broadQuery() | |
| .whereAnyContactDataPartiallyMatches(searchText) | |
| .find() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val contacts = Contacts(context).query().find() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val contacts = Contacts(context) | |
| .query() | |
| .where { | |
| (Name.GivenName startsWith "leo") and | |
| (Email.Address { endsWith("gmail.com") or endsWith("hotmail.com") }) and | |
| (Address.Country equalToIgnoreCase "us") and | |
| (Event { (Date lessThan Date().toWhereString()) and (Type equalTo EventEntity.Type.BIRTHDAY) }) and | |
| (Contact.Options.Starred equalTo true) and | |
| (Nickname.Name equalTo "DarEdEvil") and | |
| (Organization.Company `in` listOf("facebook", "FB")) and |
NewerOlder