From 87438085c66483c5858f2c78b2bbf24a0f9a2477 Mon Sep 17 00:00:00 2001 From: ganfra Date: Thu, 24 Mar 2022 18:49:57 +0100 Subject: [PATCH] RoomList: fix count not showing if not collapsable --- .../features/home/room/list/SectionHeaderAdapter.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/SectionHeaderAdapter.kt b/vector/src/main/java/im/vector/app/features/home/room/list/SectionHeaderAdapter.kt index 7633bc0d2a..3f1dfebf7b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/SectionHeaderAdapter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/SectionHeaderAdapter.kt @@ -16,8 +16,8 @@ package im.vector.app.features.home.room.list +import android.graphics.drawable.Drawable import android.view.LayoutInflater -import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat @@ -86,16 +86,16 @@ class SectionHeaderAdapter constructor( fun bind(roomsSectionData: RoomsSectionData) { binding.roomCategoryTitleView.text = roomsSectionData.name val tintColor = ThemeUtils.getColor(binding.root.context, R.attr.vctr_content_secondary) - if (roomsSectionData.isCollapsable) { - binding.roomCategoryCounterView.visibility = View.VISIBLE + val collapsableArrowDrawable: Drawable? = if (roomsSectionData.isCollapsable) { val expandedArrowDrawableRes = if (roomsSectionData.isExpanded) R.drawable.ic_expand_more else R.drawable.ic_expand_less - val expandedArrowDrawable = ContextCompat.getDrawable(binding.root.context, expandedArrowDrawableRes)?.also { + ContextCompat.getDrawable(binding.root.context, expandedArrowDrawableRes)?.also { DrawableCompat.setTint(it, tintColor) } - binding.roomCategoryCounterView.setCompoundDrawablesWithIntrinsicBounds(null, null, expandedArrowDrawable, null) } else { - binding.roomCategoryCounterView.visibility = View.GONE + null } + binding.root.isClickable = roomsSectionData.isCollapsable + binding.roomCategoryCounterView.setCompoundDrawablesWithIntrinsicBounds(null, null, collapsableArrowDrawable, null) binding.roomCategoryCounterView.text = roomsSectionData.itemCount.takeIf { it > 0 }?.toString().orEmpty() binding.roomCategoryUnreadCounterBadgeView.render(UnreadCounterBadgeView.State(roomsSectionData.notificationCount, roomsSectionData.isHighlighted)) }