-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
I just integrated the code to my recycler view adapter and there I cant able to handle single item click submit after selection.
class ProductsAdapter : RecyclerView.Adapter() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MovieViewHolder {
val inflater = LayoutInflater.from(parent.context)
return MovieViewHolder(inflater, parent)
}
override fun onBindViewHolder(holder: MovieViewHolder, position: Int) {
holder.bind()
}
override fun getItemCount(): Int = 10}
class MovieViewHolder(inflater: LayoutInflater, parent: ViewGroup) :
RecyclerView.ViewHolder(inflater.inflate(R.layout.item_product, parent, false)),
OnStateListener {
private var mTitleView: TextView? = null
private var mIncrementProductView: IncrementProductView? = null
init {
mTitleView = itemView.findViewById(R.id.amount)
}
override fun onCountChange(count: Int) {
mTitleView?.text = "$" + count * 45;
}
override fun onConfirm(count: Int) {
Toast.makeText(itemView.context, "Confirm Count : $count", Toast.LENGTH_SHORT).show()
}
override fun onClose() {
Toast.makeText(itemView.context, "Close Action", Toast.LENGTH_SHORT).show()
}
fun bind() {
mTitleView?.text = "23"
mIncrementProductView?.setOnStateListener(this)
mIncrementProductView?.setOnClickListener {
Toast.makeText(
itemView.context,
"Position clicked $adapterPosition",
Toast.LENGTH_SHORT
).show()
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels