mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-11 17:20:45 +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 {
|
runOnUiThread {
|
||||||
val currAdapter = thread_messages_list.adapter
|
val currAdapter = thread_messages_list.adapter
|
||||||
if (currAdapter == null) {
|
if (currAdapter == null) {
|
||||||
val adapter = ThreadAdapter(this, threadItems, thread_messages_list, thread_messages_fastscroller) {}
|
ThreadAdapter(this, threadItems, thread_messages_list, thread_messages_fastscroller) {
|
||||||
thread_messages_list.adapter = adapter
|
(it as? ThreadError)?.apply {
|
||||||
|
thread_type_message.setText(it.messageText)
|
||||||
|
}
|
||||||
|
}.apply {
|
||||||
|
thread_messages_list.adapter = this
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
(currAdapter as ThreadAdapter).updateMessages(threadItems)
|
(currAdapter as ThreadAdapter).updateMessages(threadItems)
|
||||||
}
|
}
|
||||||
@ -517,7 +522,7 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
items.add(message)
|
items.add(message)
|
||||||
|
|
||||||
if (message.type == Telephony.Sms.MESSAGE_TYPE_FAILED) {
|
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) {
|
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) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val item = messages[position]
|
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) {
|
when (item) {
|
||||||
is ThreadDateTime -> setupDateTime(itemView, item)
|
is ThreadDateTime -> setupDateTime(itemView, item)
|
||||||
is ThreadSuccess -> setupThreadSuccess(itemView)
|
is ThreadSuccess -> setupThreadSuccess(itemView)
|
||||||
@ -201,7 +203,7 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
|||||||
if (newHashCode != oldHashCode) {
|
if (newHashCode != oldHashCode) {
|
||||||
messages = newMessages
|
messages = newMessages
|
||||||
notifyDataSetChanged()
|
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)
|
builder.into(imageView.attachment_image)
|
||||||
imageView.attachment_image.setOnClickListener { launchViewIntent(uri, mimetype, attachment.filename) }
|
imageView.attachment_image.setOnClickListener {
|
||||||
|
launchViewIntent(uri, mimetype, attachment.filename)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (message.isReceivedMessage()) {
|
if (message.isReceivedMessage()) {
|
||||||
val attachmentView = layoutInflater.inflate(R.layout.item_received_unknown_attachment, null).apply {
|
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
|
thread_received_attachment_label.text = attachment.filename
|
||||||
}
|
}
|
||||||
setTextColor(textColor)
|
setTextColor(textColor)
|
||||||
setOnClickListener { launchViewIntent(uri, mimetype, attachment.filename) }
|
setOnClickListener {
|
||||||
|
launchViewIntent(uri, mimetype, attachment.filename)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thread_mesage_attachments_holder.addView(attachmentView)
|
thread_mesage_attachments_holder.addView(attachmentView)
|
||||||
@ -286,7 +292,9 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
|||||||
if (attachment.filename.isNotEmpty()) {
|
if (attachment.filename.isNotEmpty()) {
|
||||||
thread_sent_attachment_label.text = attachment.filename
|
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)
|
thread_mesage_attachments_holder.addView(attachmentView)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
package com.simplemobiletools.smsmessenger.models
|
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