Ink
private fun setActiveLabel(textView: TextView) { binding.apply { accounts.isSelected = binding.accounts == textView cards.isSelected = binding.cards == textView loans.isSelected = binding.loans == textView funds.isSelected = binding.funds == textView accounts.isActivated = binding.accounts == textView cards.isActivated = binding.cards == textView loans.isActivated = binding.loans == textView funds.isActivated = binding.funds == textView } when (textView) { binding.accounts -> { binding.accounts.setFocusForAccessibility() } binding.cards -> { binding.cards.setFocusForAccessibility() } binding.loans -> { binding.loans.setFocusForAccessibility() } binding.funds -> { binding.funds.setFocusForAccessibility() } } }
bezrukov
when
textView.setFocusForAccessibility()
setActiveLabel
binding.apply { listOf(accounts, cards, loans, funds).forEach { view -> view.isSelected = view === textView view.isActivated = view === textView } }
A modern programming language that makes developers happier.