I have few click listeners in my code like below:
tvLogin.setOnClickListener {
hideKeyBoard(it)
login()
}
tvForgotPassword.setOnClickListener {
hideKeyBoard(it)
navigateToForgetPassword()
}
I want to modify the passed block of code to always invoke hideKeyBoard(view)
and then my function.
Is there a way to create a higher order function that would modify a block of code and invoke passed function?
I have tried something like below:
val clickListener: (View,()->Unit) -> Unit
But not sure how it would work.
Can anyone please help how to achieve?