alexstyl / contactstore

A modern, strongly-typed contacts API for Android.
https://alexstyl.github.io/contactstore
Apache License 2.0
440 stars 15 forks source link

Use any kind of Label as custom label value when creating a CP operation #47

Closed alexstyl closed 2 years ago

alexstyl commented 2 years ago

This PR allows consumers to use any kind of Label they like in any LabeledValue.

Before this PR, creating a LabeledValue(WebAddress("www.web.com"), label = Label.Main) would throw an exception when trying to store or update a contact with this address. This was due to the fact that AOSP defines specific types for each ContactContract item.

After this PR, consumers of the API can mix and match any LabeledValue with any Label they like. The Label used will be resolved using the string resources provided by Android. In the previous example, the website will stored with the custom label of "Κύριο" if the local is set to Greek.

Addresses: https://github.com/alexstyl/contactstore/issues/1