For #21708 - Fixes missing header bottom border

The bottom gray border of the header item from the Inactive Tabs section was correctly set when collapsing or expanding said section, but not on init. So if the section was initialized collapsed the gray border would not be present.
upstream-sync
codrut.topliceanu 3 years ago committed by mergify[bot]
parent 8c34ccd8c9
commit b1a5025610

@ -38,6 +38,8 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite
itemView.apply { itemView.apply {
isActivated = InactiveTabsState.isExpanded isActivated = InactiveTabsState.isExpanded
correctHeaderBorder(isActivated)
setOnClickListener { setOnClickListener {
val newState = !it.isActivated val newState = !it.isActivated
@ -46,10 +48,7 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite
it.isActivated = newState it.isActivated = newState
binding.chevron.rotation = ROTATION_DEGREE binding.chevron.rotation = ROTATION_DEGREE
// When the header is collapsed we use its bottom border instead of the footer's correctHeaderBorder(isActivated)
binding.inactiveHeaderBorder.updatePadding(
bottom = binding.root.context.dpToPx(if (it.isActivated) 0f else 1f)
)
} }
binding.delete.setOnClickListener { binding.delete.setOnClickListener {
@ -58,6 +57,15 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite
} }
} }
/**
* When the header is collapsed we use its bottom border instead of the footer's
*/
private fun correctHeaderBorder(isActivated: Boolean) {
binding.inactiveHeaderBorder.updatePadding(
bottom = binding.root.context.dpToPx(if (isActivated) 0f else 1f)
)
}
companion object { companion object {
const val LAYOUT_ID = R.layout.inactive_header_item const val LAYOUT_ID = R.layout.inactive_header_item
private const val ROTATION_DEGREE = 180F private const val ROTATION_DEGREE = 180F

Loading…
Cancel
Save