override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (event.action == KeyEvent.ACTION_DOWN) {
when (keyCode) {
// check and return true/false
}
}
return super.onKeyDown(keyCode, event)
}
In this above code I need time to decide whether to pass the consumed
or not comused
status to next layers. I am required to do that asynchronously because the time to decide return value (i.e. true or false) might be longer and the function shouldn't keep main thread await.
What is the proper way to get rid of this problem? Any specific design pattern to deal this kind of problem?
Please ignore the language.
Aucun commentaire:
Enregistrer un commentaire