IncrementProductView icon indicating copy to clipboard operation
IncrementProductView copied to clipboard

not working in recyclerview adapter

Open karthi72 opened this issue 4 years ago • 0 comments

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<MovieViewHolder>() { 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()
    }
}

}

karthi72 avatar May 14 '20 13:05 karthi72