properly show locally stored contact names at the Recents tab

This commit is contained in:
tibbi 2018-11-29 22:47:37 +01:00
parent e302309fe9
commit 2cff407b96
1 changed files with 9 additions and 0 deletions

View File

@ -540,6 +540,15 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
if (refreshTabsMask and RECENTS_TAB_MASK != 0) {
ContactsHelper(this).getRecents {
val localContacts = LocalContactsHelper(applicationContext).getAllContacts()
it.filter { it.name == null }.forEach {
val namelessCall = it
val localContact = localContacts.firstOrNull { it.doesContainPhoneNumber(namelessCall.number) }
if (localContact != null) {
it.name = localContact.getNameToDisplay()
}
}
runOnUiThread {
recents_fragment?.updateRecentCalls(it)
}