use proper placeholder avatars at private contacts too
This commit is contained in:
parent
8760d85d2b
commit
83dcc7423c
3 changed files with 10 additions and 1 deletions
|
|
@ -95,14 +95,22 @@ class ThreadActivity : SimpleActivity() {
|
|||
messages.first().participants
|
||||
}
|
||||
|
||||
val senderNumbersToReplace = HashMap<String, String>()
|
||||
// check if no participant came from a privately stored contact in Simple Contacts
|
||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
||||
participants.filter { it.name == it.phoneNumber }.forEach { participant ->
|
||||
privateContacts.firstOrNull { it.phoneNumber == participant.phoneNumber }?.apply {
|
||||
senderNumbersToReplace[participant.phoneNumber] = name
|
||||
participant.name = name
|
||||
}
|
||||
}
|
||||
|
||||
messages.forEach { message ->
|
||||
if (senderNumbersToReplace.keys.contains(message.senderName)) {
|
||||
message.senderName = senderNumbersToReplace[message.senderName]!!
|
||||
}
|
||||
}
|
||||
|
||||
if (participants.isEmpty()) {
|
||||
val name = intent.getStringExtra(THREAD_TITLE) ?: ""
|
||||
val number = intent.getStringExtra(THREAD_NUMBER)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue