mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-06 04:13:30 +01:00
allow clicking the message failed label
This commit is contained in:
parent
c3826dc9f2
commit
a100ddb290
@ -224,8 +224,13 @@ class ThreadActivity : SimpleActivity() {
|
||||
runOnUiThread {
|
||||
val currAdapter = thread_messages_list.adapter
|
||||
if (currAdapter == null) {
|
||||
val adapter = ThreadAdapter(this, threadItems, thread_messages_list, thread_messages_fastscroller) {}
|
||||
thread_messages_list.adapter = adapter
|
||||
ThreadAdapter(this, threadItems, thread_messages_list, thread_messages_fastscroller) {
|
||||
(it as? ThreadError)?.apply {
|
||||
thread_type_message.setText(it.messageText)
|
||||
}
|
||||
}.apply {
|
||||
thread_messages_list.adapter = this
|
||||
}
|
||||
} else {
|
||||
(currAdapter as ThreadAdapter).updateMessages(threadItems)
|
||||
}
|
||||
@ -517,7 +522,7 @@ class ThreadActivity : SimpleActivity() {
|
||||
items.add(message)
|
||||
|
||||
if (message.type == Telephony.Sms.MESSAGE_TYPE_FAILED) {
|
||||
items.add(ThreadError(message.id))
|
||||
items.add(ThreadError(message.id, message.body))
|
||||
}
|
||||
|
||||
if (message.type == Telephony.Sms.MESSAGE_TYPE_OUTBOX) {
|
||||
|
@ -105,7 +105,9 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val item = messages[position]
|
||||
holder.bindView(item, true, item is Message) { itemView, layoutPosition ->
|
||||
val isClickable = item is ThreadError || item is Message
|
||||
val isLongClickable = item is Message
|
||||
holder.bindView(item, isClickable, isLongClickable) { itemView, layoutPosition ->
|
||||
when (item) {
|
||||
is ThreadDateTime -> setupDateTime(itemView, item)
|
||||
is ThreadSuccess -> setupThreadSuccess(itemView)
|
||||
@ -201,7 +203,7 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
||||
if (newHashCode != oldHashCode) {
|
||||
messages = newMessages
|
||||
notifyDataSetChanged()
|
||||
recyclerView.scrollToPosition(messages.size-1)
|
||||
recyclerView.scrollToPosition(messages.size - 1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,7 +266,9 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
||||
}
|
||||
|
||||
builder.into(imageView.attachment_image)
|
||||
imageView.attachment_image.setOnClickListener { launchViewIntent(uri, mimetype, attachment.filename) }
|
||||
imageView.attachment_image.setOnClickListener {
|
||||
launchViewIntent(uri, mimetype, attachment.filename)
|
||||
}
|
||||
} else {
|
||||
if (message.isReceivedMessage()) {
|
||||
val attachmentView = layoutInflater.inflate(R.layout.item_received_unknown_attachment, null).apply {
|
||||
@ -273,7 +277,9 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
||||
thread_received_attachment_label.text = attachment.filename
|
||||
}
|
||||
setTextColor(textColor)
|
||||
setOnClickListener { launchViewIntent(uri, mimetype, attachment.filename) }
|
||||
setOnClickListener {
|
||||
launchViewIntent(uri, mimetype, attachment.filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
thread_mesage_attachments_holder.addView(attachmentView)
|
||||
@ -286,7 +292,9 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
||||
if (attachment.filename.isNotEmpty()) {
|
||||
thread_sent_attachment_label.text = attachment.filename
|
||||
}
|
||||
setOnClickListener { launchViewIntent(uri, mimetype, attachment.filename) }
|
||||
setOnClickListener {
|
||||
launchViewIntent(uri, mimetype, attachment.filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
thread_mesage_attachments_holder.addView(attachmentView)
|
||||
|
@ -1,3 +1,3 @@
|
||||
package com.simplemobiletools.smsmessenger.models
|
||||
|
||||
data class ThreadError(val messageId: Long) : ThreadItem()
|
||||
data class ThreadError(val messageId: Long, val messageText: String) : ThreadItem()
|
||||
|
Loading…
x
Reference in New Issue
Block a user