Organize CursorToConversation class

This commit is contained in:
Moez Bhatti
2017-12-21 19:46:58 -05:00
parent dc026e0471
commit 84c887a44d
@@ -9,16 +9,6 @@ import javax.inject.Inject
class CursorToConversation @Inject constructor() : Mapper<Cursor, Conversation> {
override fun map(from: Cursor): Conversation {
return Conversation().apply {
id = from.getLong(ID)
recipients.addAll(from.getString(RECIPIENT_IDS)
.split(" ")
.map { recipientId -> recipientId.toLong() }
.map { recipientId -> Recipient().apply { id = recipientId } })
}
}
companion object {
val URI: Uri = Uri.parse("content://mms-sms/conversations?simple=true")
val PROJECTION = arrayOf(
@@ -29,4 +19,14 @@ class CursorToConversation @Inject constructor() : Mapper<Cursor, Conversation>
val RECIPIENT_IDS = 1
}
override fun map(from: Cursor): Conversation {
return Conversation().apply {
id = from.getLong(ID)
recipients.addAll(from.getString(RECIPIENT_IDS)
.split(" ")
.map { recipientId -> recipientId.toLong() }
.map { recipientId -> Recipient().apply { id = recipientId } })
}
}
}