fix: added birthdays and anniversaries to provided contact content.

This commit is contained in:
ismailnurudeen 2023-02-20 15:10:39 +01:00
parent 7960a721dc
commit 7bff8457b2
2 changed files with 6 additions and 5 deletions

View file

@ -93,9 +93,10 @@ class MyContactsContentProvider {
middleName = middleName,
surname = surname,
photoUri = photoUri,
phoneNumbers = phoneNumbers)
// birthdays,
// anniversaries
phoneNumbers = phoneNumbers).also {
it.birthdays = birthdays
it.anniversaries = anniversaries
}
contacts.add(contact)
} while (cursor.moveToNext())

View file

@ -36,8 +36,8 @@ data class Contact(
) : Comparable<Contact> {
val rawId = id
val name = getNameToDisplay()
val birthdays = events.filter { it.type == ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY }.map { it.value }.toMutableList() as ArrayList<String>
val anniversaries = events.filter { it.type == ContactsContract.CommonDataKinds.Event.TYPE_ANNIVERSARY }.map { it.value }.toMutableList() as ArrayList<String>
var birthdays = events.filter { it.type == ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY }.map { it.value }.toMutableList() as ArrayList<String>
var anniversaries = events.filter { it.type == ContactsContract.CommonDataKinds.Event.TYPE_ANNIVERSARY }.map { it.value }.toMutableList() as ArrayList<String>
companion object {
var sorting = 0