Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for EXTRA_ADDRESS_BOOK_INDEX[_COUNTS|_TITLES] #348

Open
NLLAPPS opened this issue Apr 16, 2024 · 2 comments
Open

Add support for EXTRA_ADDRESS_BOOK_INDEX[_COUNTS|_TITLES] #348

NLLAPPS opened this issue Apr 16, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@NLLAPPS
Copy link

NLLAPPS commented Apr 16, 2024

Not sure if I am missing it but android provides Section indexer for contacts so that you can show sections per letter in contact list.
It might be be good to include it in the library.

val uriWithContactIndexes = ContactsContract.Data.CONTENT_URI.buildUpon()
.appendQueryParameter(ContactsContract.Contacts.EXTRA_ADDRESS_BOOK_INDEX, "true")
.build()

https://cs.android.com/android/platform/superproject/main/+/main:packages/apps/Contacts/src/com/android/contacts/list/ContactsSectionIndexer.java

https://developer.android.com/reference/android/provider/ContactsContract.Data#EXTRA_ADDRESS_BOOK_INDEX_TITLES

https://android.googlesource.com/platform/cts/+/c35d791/tests/tests/provider/src/android/provider/cts/ContactsContract_ContactCountsTest.java

@vestrel00 vestrel00 added the enhancement New feature or request label Apr 16, 2024
@vestrel00 vestrel00 added this to the More awesome features! milestone Apr 16, 2024
@vestrel00 vestrel00 self-assigned this Apr 16, 2024
@vestrel00
Copy link
Owner

vestrel00 commented Apr 16, 2024

Hey! You didn't miss it. I just haven't added support for it yet haha. IMO, the current APIs should technically be enough to create a similar behavior even without this extra. I'm not familiar with this so I will have to do some research on it and play around with it to see how I can nicely add it on to the existing query APIs.

In any case, I will look into implementing this as part of a future release; 0.3.3

Thanks 😃

@vestrel00 vestrel00 changed the title EXTRA_ADDRESS_BOOK_INDEX_TITLES Add support for EXTRA_ADDRESS_BOOK_INDEX[_COUNTS|_TITLES] Apr 16, 2024
@NLLAPPS
Copy link
Author

NLLAPPS commented Apr 16, 2024

Thanks, I have been doing it on my own until I have noticed it in ContactsCotract. Creating sections by your self have so many gotchas. For example, Pinyin, Japanese or using phonetic name etc.

ContactsContract deals with all. ContactsSectionIndexer.java and ContactsContract_ContactCountsTest.java have examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants