Created
February 3, 2018 18:59
-
-
Save dcampogiani/1eb74b2125073ac8a2f6cfcb5c580df4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EitherActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_input) | |
val viewModel = ViewModelProviders.of(this)[EitherViewModel::class.java] | |
signup_button.setOnClickListener { | |
viewModel.validate(email.text.toString(), number.text.toString()) | |
} | |
viewModel.validation.observe(this, Observer { | |
it?.fold(this::handleLeft, this::handleRight) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment