Skip to content

Instantly share code, notes, and snippets.

@makorowy
Last active March 2, 2019 13:11
Show Gist options
  • Select an option

  • Save makorowy/f91643aff28cff35acc7bf4ee95383ad to your computer and use it in GitHub Desktop.

Select an option

Save makorowy/f91643aff28cff35acc7bf4ee95383ad to your computer and use it in GitHub Desktop.
Sample for article needs - How to create a compound view?
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
consent1.setOnCheckedChangeListener { _, _ -> validateConsents() }
consent2.setOnCheckedChangeListener { _, _ -> validateConsents() }
}
private fun validateConsents() {
confirmButton.isEnabled = consent1.isChecked && consent2.isChecked
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment