display contact names loaded from db

This commit is contained in:
Moez Bhatti
2017-08-28 16:41:54 -07:00
parent 15c6cc159d
commit 39be6fee0b
7 changed files with 36 additions and 25 deletions
@@ -7,10 +7,8 @@ open class Contact() : RealmObject() {
@PrimaryKey var recipientId: Long = 0
var address: String = ""
var name: String = ""
/**
* For inflating the contact using the cursor
*/
constructor(id: Long, address: String) : this() {
this.recipientId = id
this.address = address
@@ -44,7 +44,7 @@ open class Conversation() : RealmObject() {
fun getTitle(): String {
var title = ""
contacts.forEachIndexed { index, recipient ->
title += recipient.address
title += if (recipient.name.isNotEmpty()) recipient.name else recipient.address
if (index < contacts.size - 1) {
title += ", "
}