mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-16 19:50:40 +01:00
Remove unused click listeners and callbacks
This commit is contained in:
parent
fedc52adc3
commit
7c02e33bbd
@ -916,7 +916,6 @@ class ThreadActivity : SimpleActivity() {
|
||||
adapter = AttachmentsAdapter(
|
||||
activity = this,
|
||||
recyclerView = thread_attachments_recyclerview,
|
||||
onItemClick = {},
|
||||
onAttachmentsRemoved = {
|
||||
thread_attachments_recyclerview.beGone()
|
||||
checkSendMessageAvailability()
|
||||
|
@ -32,7 +32,6 @@ import kotlinx.android.synthetic.main.item_remove_attachment_button.view.*
|
||||
class AttachmentsAdapter(
|
||||
val activity: BaseSimpleActivity,
|
||||
val recyclerView: RecyclerView,
|
||||
val onItemClick: (AttachmentSelection) -> Unit,
|
||||
val onAttachmentsRemoved: () -> Unit,
|
||||
val onReady: (() -> Unit)
|
||||
) : ListAdapter<AttachmentSelection, AttachmentsAdapter.ViewHolder>(AttachmentDiffCallback()) {
|
||||
@ -85,7 +84,7 @@ class AttachmentsAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val attachment = getItem(position)
|
||||
holder.bindView(attachment, allowSingleClick = true, allowLongClick = false) { view, position ->
|
||||
holder.bindView() { view, _ ->
|
||||
when (attachment.viewType) {
|
||||
ATTACHMENT_DOCUMENT -> {
|
||||
view.setupDocumentPreview(
|
||||
@ -189,32 +188,11 @@ class AttachmentsAdapter(
|
||||
}
|
||||
|
||||
open inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
fun bindView(
|
||||
any: AttachmentSelection,
|
||||
allowSingleClick: Boolean,
|
||||
allowLongClick: Boolean,
|
||||
callback: (itemView: View, adapterPosition: Int) -> Unit
|
||||
): View {
|
||||
fun bindView(callback: (itemView: View, adapterPosition: Int) -> Unit): View {
|
||||
return itemView.apply {
|
||||
callback(this, adapterPosition)
|
||||
|
||||
if (allowSingleClick) {
|
||||
setOnClickListener { viewClicked(any) }
|
||||
setOnLongClickListener { if (allowLongClick) viewLongClicked() else viewClicked(any); true }
|
||||
} else {
|
||||
setOnClickListener(null)
|
||||
setOnLongClickListener(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun viewClicked(any: AttachmentSelection) {
|
||||
onItemClick.invoke(any)
|
||||
}
|
||||
|
||||
private fun viewLongClicked() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user