correctly bind actionbar in messagelist activity

This commit is contained in:
Moez Bhatti
2017-08-28 15:45:41 -07:00
parent 22489af4c3
commit f7aba7c5bd
9 changed files with 53 additions and 12 deletions
@@ -40,4 +40,16 @@ open class Conversation() : RealmObject() {
error = cursor.getInt(ConversationColumns.ERROR)
hasAttachment = cursor.getInt(ConversationColumns.HAS_ATTACHMENT)
}
fun getTitle(): String {
var title = ""
contacts.forEachIndexed { index, recipient ->
title += recipient.address
if (index < contacts.size - 1) {
title += ", "
}
}
return title
}
}
@@ -6,6 +6,13 @@ import io.realm.RealmResults
class ConversationRepository {
fun getConversation(threadId: Long): RealmResults<Conversation> {
return Realm.getDefaultInstance()
.where(Conversation::class.java)
.equalTo("id", threadId)
.findAllAsync()
}
fun getConversations(): RealmResults<Conversation> {
return Realm.getDefaultInstance().where(Conversation::class.java).findAllAsync()
}