Skip to content

Instantly share code, notes, and snippets.

@arriolac
Last active October 10, 2023 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arriolac/6e52a62c711d68c7179f82a3d074287c to your computer and use it in GitHub Desktop.
Save arriolac/6e52a62c711d68c7179f82a3d074287c to your computer and use it in GitHub Desktop.
Refactoring CheckBox to not be stateful
// Copyright 2023 Google LLC.
// SPDX-License-Identifier: Apache-2.0
class CheckBox(context: Context) : View(context) {
override fun performClick(): Boolean {
// Refactor: prevent the checkbox from toggling when clicked
// toggleCheck()
return super.performClick()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment