Skip to content

Instantly share code, notes, and snippets.

@Laimiux
Last active April 3, 2018 02:55
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 Laimiux/68d65d0f48168adfd152668177ce7737 to your computer and use it in GitHub Desktop.
Save Laimiux/68d65d0f48168adfd152668177ce7737 to your computer and use it in GitHub Desktop.
class CommentFormView(val rootView: View) {
// View binding logic
val commentTextField: EditText = rootView.findViewById(R.id.comment_text_field)
val submitButton: Button = rootView.findViewById(R.id.submit_button)
// Our view update function, takes a view state
// snapshot and updates the android views
fun setViewState(state: CommentFormViewState) {
commentTextField.text = state.textEntered
submitButton.isEnabled = state.isSubmitButtonEnabled
// update the listeners ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment