Created
December 4, 2017 15:01
-
-
Save javikin/f73688e44dfa2b54cef50ab81f8cc3da 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 MyAdapter(val mDataset: Array<String>, | |
val itemClickListener: (String) -> Unit, | |
val itemClickButtonListener: (String) -> Unit) : | |
RecyclerView.Adapter<MyAdapter.ViewHolder>() { | |
... | |
class ViewHolder(var mView: View) : RecyclerView.ViewHolder(mView) { | |
fun bind(item: String, | |
itemClickListener: (String) -> Unit, | |
itemClickButtonListener: (String) -> Unit) = with(itemView) { | |
itemView.button_ok.setOnClickListener { itemClickButtonListener(item) } | |
setOnClickListener { itemClickListener(item) } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment