show contact name of caller (if exists) when call comes in
This commit is contained in:
@ -122,6 +122,14 @@ class ContactsActivity : AppCompatActivity() {
|
||||
return false
|
||||
}
|
||||
|
||||
fun contactName(uri: String): String {
|
||||
for (c in contacts)
|
||||
if ((Utils.uriUserPart(c.uri) == Utils.uriUserPart(uri)) &&
|
||||
(Utils.uriHostPart(c.uri) == Utils.uriHostPart(uri)))
|
||||
return c.name
|
||||
return uri
|
||||
}
|
||||
|
||||
external fun contacts_remove()
|
||||
external fun contact_add(contact: String)
|
||||
|
||||
|
||||
@ -784,7 +784,7 @@ class MainActivity : AppCompatActivity() {
|
||||
caller_row.layoutParams = caller_row_params
|
||||
|
||||
val caller_uri = TextView(applicationContext)
|
||||
caller_uri.text = call.peerURI
|
||||
caller_uri.text = ContactsActivity.contactName(call.peerURI)
|
||||
caller_uri.setTextColor(Color.BLUE)
|
||||
caller_uri.textSize = 20f
|
||||
caller_uri.setPadding(10, 10, 0, 10)
|
||||
|
||||
Reference in New Issue
Block a user