recognize contact photos at SMS too
This commit is contained in:
parent
bbc1f53a74
commit
718afea9d6
1 changed files with 4 additions and 2 deletions
|
|
@ -69,11 +69,13 @@ fun Context.getMessages(threadId: Int? = null): ArrayList<Message> {
|
||||||
val body = cursor.getStringValue(Sms.BODY)
|
val body = cursor.getStringValue(Sms.BODY)
|
||||||
val type = cursor.getIntValue(Sms.TYPE)
|
val type = cursor.getIntValue(Sms.TYPE)
|
||||||
val senderNumber = cursor.getStringValue(Sms.ADDRESS)
|
val senderNumber = cursor.getStringValue(Sms.ADDRESS)
|
||||||
val senderName = getNameAndPhotoFromPhoneNumber(senderNumber)?.name ?: ""
|
val namePhoto = getNameAndPhotoFromPhoneNumber(senderNumber)
|
||||||
|
val senderName = namePhoto?.name ?: ""
|
||||||
|
val photoUri = namePhoto?.photoUri ?: ""
|
||||||
val date = (cursor.getLongValue(Sms.DATE) / 1000).toInt()
|
val date = (cursor.getLongValue(Sms.DATE) / 1000).toInt()
|
||||||
val read = cursor.getIntValue(Sms.READ) == 1
|
val read = cursor.getIntValue(Sms.READ) == 1
|
||||||
val thread = cursor.getIntValue(Sms.THREAD_ID)
|
val thread = cursor.getIntValue(Sms.THREAD_ID)
|
||||||
val participant = Contact(0, senderName, "", senderNumber, false)
|
val participant = Contact(0, senderName, photoUri, senderNumber, false)
|
||||||
val isMMS = false
|
val isMMS = false
|
||||||
val message = Message(id, body, type, arrayListOf(participant), date, read, thread, isMMS, null)
|
val message = Message(id, body, type, arrayListOf(participant), date, read, thread, isMMS, null)
|
||||||
messages.add(message)
|
messages.add(message)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue