removing some redundant functions
This commit is contained in:
parent
f2c368e12e
commit
e79818d789
|
@ -18,6 +18,7 @@ import com.simplemobiletools.smsmessenger.R
|
||||||
import com.simplemobiletools.smsmessenger.adapters.ThreadsAdapter
|
import com.simplemobiletools.smsmessenger.adapters.ThreadsAdapter
|
||||||
import com.simplemobiletools.smsmessenger.extensions.config
|
import com.simplemobiletools.smsmessenger.extensions.config
|
||||||
import com.simplemobiletools.smsmessenger.extensions.getMessages
|
import com.simplemobiletools.smsmessenger.extensions.getMessages
|
||||||
|
import com.simplemobiletools.smsmessenger.extensions.getThreadTitle
|
||||||
import com.simplemobiletools.smsmessenger.helpers.THREAD_ID
|
import com.simplemobiletools.smsmessenger.helpers.THREAD_ID
|
||||||
import com.simplemobiletools.smsmessenger.helpers.THREAD_TITLE
|
import com.simplemobiletools.smsmessenger.helpers.THREAD_TITLE
|
||||||
import com.simplemobiletools.smsmessenger.models.Events
|
import com.simplemobiletools.smsmessenger.models.Events
|
||||||
|
@ -139,7 +140,7 @@ class MainActivity : SimpleActivity() {
|
||||||
ThreadsAdapter(this, messages, messages_list, messages_fastscroller) {
|
ThreadsAdapter(this, messages, messages_list, messages_fastscroller) {
|
||||||
Intent(this, ThreadActivity::class.java).apply {
|
Intent(this, ThreadActivity::class.java).apply {
|
||||||
putExtra(THREAD_ID, (it as Message).thread)
|
putExtra(THREAD_ID, (it as Message).thread)
|
||||||
putExtra(THREAD_TITLE, it.getThreadTitle())
|
putExtra(THREAD_TITLE, it.participants.getThreadTitle())
|
||||||
startActivity(this)
|
startActivity(this)
|
||||||
}
|
}
|
||||||
}.apply {
|
}.apply {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
import com.simplemobiletools.smsmessenger.R
|
import com.simplemobiletools.smsmessenger.R
|
||||||
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
||||||
import com.simplemobiletools.smsmessenger.extensions.deleteThread
|
import com.simplemobiletools.smsmessenger.extensions.deleteThread
|
||||||
|
import com.simplemobiletools.smsmessenger.extensions.getThreadTitle
|
||||||
import com.simplemobiletools.smsmessenger.extensions.loadImage
|
import com.simplemobiletools.smsmessenger.extensions.loadImage
|
||||||
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
|
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
|
||||||
import com.simplemobiletools.smsmessenger.models.Message
|
import com.simplemobiletools.smsmessenger.models.Message
|
||||||
|
@ -117,7 +118,7 @@ class ThreadsAdapter(
|
||||||
view.apply {
|
view.apply {
|
||||||
thread_frame.isSelected = selectedKeys.contains(message.id)
|
thread_frame.isSelected = selectedKeys.contains(message.id)
|
||||||
|
|
||||||
thread_address.text = message.getThreadTitle()
|
thread_address.text = message.participants.getThreadTitle()
|
||||||
thread_body_short.text = message.body
|
thread_body_short.text = message.body
|
||||||
thread_date.text = message.date.formatDateOrTime(context, true)
|
thread_date.text = message.date.formatDateOrTime(context, true)
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
package com.simplemobiletools.smsmessenger.models
|
package com.simplemobiletools.smsmessenger.models
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.provider.Telephony
|
import android.provider.Telephony
|
||||||
import com.simplemobiletools.smsmessenger.extensions.getThreadTitle
|
|
||||||
|
|
||||||
data class Message(
|
data class Message(
|
||||||
val id: Int, val body: String, val type: Int, val participants: ArrayList<Contact>, val date: Int, val read: Boolean, val thread: Int,
|
val id: Int, val body: String, val type: Int, val participants: ArrayList<Contact>, val date: Int, val read: Boolean, val thread: Int,
|
||||||
val isMMS: Boolean, val attachment: MessageAttachment?
|
val isMMS: Boolean, val attachment: MessageAttachment?
|
||||||
) : ThreadItem() {
|
) : ThreadItem() {
|
||||||
fun isReceivedMessage() = type == Telephony.Sms.MESSAGE_TYPE_INBOX
|
fun isReceivedMessage() = type == Telephony.Sms.MESSAGE_TYPE_INBOX
|
||||||
|
|
||||||
fun getThreadTitle() = participants.getThreadTitle()
|
|
||||||
|
|
||||||
fun getThreadImageUri() = participants.firstOrNull()?.photoUri
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue