forked from upstream-mirrors/quik
Organize CursorToConversation class
This commit is contained in:
@@ -9,16 +9,6 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
class CursorToConversation @Inject constructor() : Mapper<Cursor, Conversation> {
|
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 {
|
companion object {
|
||||||
val URI: Uri = Uri.parse("content://mms-sms/conversations?simple=true")
|
val URI: Uri = Uri.parse("content://mms-sms/conversations?simple=true")
|
||||||
val PROJECTION = arrayOf(
|
val PROJECTION = arrayOf(
|
||||||
@@ -29,4 +19,14 @@ class CursorToConversation @Inject constructor() : Mapper<Cursor, Conversation>
|
|||||||
val RECIPIENT_IDS = 1
|
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 } })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user