Merge pull request #251 from KryptKode/feat/longpress-attachment

handle long-press of attachment
This commit is contained in:
Tibor Kaputa 2021-11-15 14:42:57 +01:00 committed by GitHub
commit 3f83c69324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,8 +283,16 @@ class ThreadAdapter(
builder.into(imageView.attachment_image)
imageView.attachment_image.setOnClickListener {
if (actModeCallback.isSelectable) {
holder.viewClicked(message)
} else {
launchViewIntent(uri, mimetype, attachment.filename)
}
}
imageView.setOnLongClickListener {
holder.viewLongClicked()
true
}
} else {
if (message.isReceivedMessage()) {
val attachmentView = layoutInflater.inflate(R.layout.item_received_unknown_attachment, null).apply {
@ -294,9 +302,17 @@ class ThreadAdapter(
}
setTextColor(textColor)
setOnClickListener {
if (actModeCallback.isSelectable) {
holder.viewClicked(message)
} else {
launchViewIntent(uri, mimetype, attachment.filename)
}
}
setOnLongClickListener {
holder.viewLongClicked()
true
}
}
}
thread_mesage_attachments_holder.addView(attachmentView)
} else {
@ -309,9 +325,17 @@ class ThreadAdapter(
thread_sent_attachment_label.text = attachment.filename
}
setOnClickListener {
if (actModeCallback.isSelectable) {
holder.viewClicked(message)
} else {
launchViewIntent(uri, mimetype, attachment.filename)
}
}
setOnLongClickListener {
holder.viewLongClicked()
true
}
}
}
thread_mesage_attachments_holder.addView(attachmentView)
}