Created
July 5, 2020 23:39
-
-
Save Garyfimo/cd68b838f81b49add959133a21c57af9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 MainActivity : AppCompatActivity(), ServiceLocatorActivity { | |
override val self: Activity = this | |
private val mainViewModelFactory: MainViewModelFactory by lazy { | |
serviceLocator.mainViewModelFactory | |
} | |
private val viewModel: MainViewModel by viewModels { | |
mainViewModelFactory | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
observarTextOperacion() | |
configurarClickListener() | |
} | |
private fun observarTextOperacion() { | |
viewModel.operacion.observe(this, Observer { expresionOperacion -> | |
tvVisualizadorOperacion?.text = expresionOperacion | |
}) | |
} | |
private fun configurarClickListener() { | |
btnCero?.setOnClickListener { viewModel.onClick(ViewEvent.ClickNumero(Numeros.CERO)) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment