Skip to content

Instantly share code, notes, and snippets.

@theerasan
Created July 10, 2017 19:30
Show Gist options
  • Select an option

  • Save theerasan/f3ac1a533dda6f49555cdf798c47eaf5 to your computer and use it in GitHub Desktop.

Select an option

Save theerasan/f3ac1a533dda6f49555cdf798c47eaf5 to your computer and use it in GitHub Desktop.
class LoginWithBindingActivity : AppCompatActivity(), LoginWithBindingInf.ViewInf {
var binding: ActivityLoginWithBindingBinding? = null
var viewModel: LoginDataBindingViewModel? = null
var presenter: LoginWithBindingInf.PresenterInf? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initView()
initViewModel()
initPresenter()
}
private fun initView() {
binding = DataBindingUtil
.setContentView(this, R.layout.activity_login_with_binding)
}
private fun initViewModel() {
viewModel = LoginDataBindingViewModel()
binding!!.viewModel = viewModel
}
private fun initPresenter() {
presenter = LoginWithBindingPresenter(viewModel, this)
presenter!!.onInit()
}
override fun performLogin(stringToShow: String) {
Toast.makeText(this, stringToShow, Toast.LENGTH_LONG).show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment