mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 09:56:00 +03:00
Removing some with() code pattern
This commit is contained in:
parent
a826a50c10
commit
0942c6d648
2 changed files with 10 additions and 14 deletions
|
@ -48,10 +48,8 @@ abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
||||||
}
|
}
|
||||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(unreadNotificationCount, showHighlighted))
|
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(unreadNotificationCount, showHighlighted))
|
||||||
holder.titleView.text = title
|
holder.titleView.text = title
|
||||||
with(holder.counterView) {
|
holder.counterView.text = itemCount.takeIf { it > 0 }?.toString().orEmpty()
|
||||||
text = itemCount.takeIf { it > 0 }?.toString().orEmpty()
|
holder.counterView.setCompoundDrawablesWithIntrinsicBounds(null, null, expandedArrowDrawable, null)
|
||||||
setCompoundDrawablesWithIntrinsicBounds(null, null, expandedArrowDrawable, null)
|
|
||||||
}
|
|
||||||
holder.rootView.onClick(listener)
|
holder.rootView.onClick(listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,17 +80,15 @@ class SectionHeaderAdapter constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bind(roomsSectionData: RoomsSectionData) {
|
fun bind(roomsSectionData: RoomsSectionData) {
|
||||||
with(binding) {
|
binding.roomCategoryTitleView.text = roomsSectionData.name
|
||||||
roomCategoryTitleView.text = roomsSectionData.name
|
val tintColor = ThemeUtils.getColor(binding.root.context, R.attr.vctr_content_secondary)
|
||||||
val tintColor = ThemeUtils.getColor(root.context, R.attr.vctr_content_secondary)
|
val expandedArrowDrawableRes = if (roomsSectionData.isExpanded) R.drawable.ic_expand_more else R.drawable.ic_expand_less
|
||||||
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 {
|
||||||
val expandedArrowDrawable = ContextCompat.getDrawable(root.context, expandedArrowDrawableRes)?.also {
|
DrawableCompat.setTint(it, tintColor)
|
||||||
DrawableCompat.setTint(it, tintColor)
|
|
||||||
}
|
|
||||||
roomCategoryCounterView.setCompoundDrawablesWithIntrinsicBounds(null, null, expandedArrowDrawable, null)
|
|
||||||
roomCategoryCounterView.text = roomsSectionData.itemCount.takeIf { it > 0 }?.toString().orEmpty()
|
|
||||||
roomCategoryUnreadCounterBadgeView.render(UnreadCounterBadgeView.State(roomsSectionData.notificationCount, roomsSectionData.isHighlighted))
|
|
||||||
}
|
}
|
||||||
|
binding.roomCategoryCounterView.setCompoundDrawablesWithIntrinsicBounds(null, null, expandedArrowDrawable, null)
|
||||||
|
binding.roomCategoryCounterView.text = roomsSectionData.itemCount.takeIf { it > 0 }?.toString().orEmpty()
|
||||||
|
binding.roomCategoryUnreadCounterBadgeView.render(UnreadCounterBadgeView.State(roomsSectionData.notificationCount, roomsSectionData.isHighlighted))
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
Loading…
Reference in a new issue