From 7098e787150a8f72c779b358d669b77b0e9ad134 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Thu, 31 Aug 2023 14:51:35 +0200 Subject: [PATCH] collapse by clicking children Signed-off-by: Marcel Hibbe --- .../messages/SystemMessageViewHolder.kt | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/SystemMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/SystemMessageViewHolder.kt index 8c3d9d64e9..94d76f9f5d 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/SystemMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/SystemMessageViewHolder.kt @@ -107,23 +107,15 @@ class SystemMessageViewHolder(itemView: View) : MessageHolders.IncomingTextMessa binding.expandCollapseIcon.setImageDrawable( ContextCompat.getDrawable(context!!, R.drawable.baseline_unfold_more_24) ) - binding.systemMessageLayout.setOnClickListener { - systemMessageInterface.expandSystemMessage(message) - } - binding.messageText.setOnClickListener { - systemMessageInterface.expandSystemMessage(message) - } + binding.systemMessageLayout.setOnClickListener { systemMessageInterface.expandSystemMessage(message) } + binding.messageText.setOnClickListener { systemMessageInterface.expandSystemMessage(message) } } else { binding.messageText.text = messageString binding.expandCollapseIcon.setImageDrawable( ContextCompat.getDrawable(context!!, R.drawable.baseline_unfold_less_24) ) - binding.systemMessageLayout.setOnClickListener { - systemMessageInterface.collapseSystemMessages() - } - binding.messageText.setOnClickListener { - systemMessageInterface.collapseSystemMessages() - } + binding.systemMessageLayout.setOnClickListener { systemMessageInterface.collapseSystemMessages() } + binding.messageText.setOnClickListener { systemMessageInterface.collapseSystemMessages() } } } else if (message.hiddenByCollapse) { binding.systemMessageLayout.visibility = View.GONE @@ -134,9 +126,10 @@ class SystemMessageViewHolder(itemView: View) : MessageHolders.IncomingTextMessa binding.systemMessageLayout.setOnClickListener(null) } - // if (!message.expandableParent && message.lastExpandedItemOfGroup != 0) { - // binding.systemMessageLayout.setOnClickListener { systemMessageInterface.collapseSystemMessages() } - // } + if (!message.expandableParent && message.lastItemOfExpandableGroup != 0) { + binding.systemMessageLayout.setOnClickListener { systemMessageInterface.collapseSystemMessages() } + binding.messageText.setOnClickListener { systemMessageInterface.collapseSystemMessages() } + } binding.messageTime.text = dateUtils!!.getLocalTimeStringFromTimestamp(message.timestamp) itemView.setTag(R.string.replyable_message_view_tag, message.replyable)