Skip to content

Instantly share code, notes, and snippets.

View kashyapasrc's full-sized avatar
💭
I may be slow to respond.

Addepalli Sri Rama Chandra Kashyap kashyapasrc

💭
I may be slow to respond.
  • India-Bharat-Jambudweep-Aryavarta
  • 16:04 (UTC +05:30)
View GitHub Profile
@arcadefire
arcadefire / RecyclerViewExtension.kt
Last active April 20, 2023 10:14
Add addOnItemClickListener easily to a RecyclerView using Kotlin
import android.support.v7.widget.RecyclerView
import android.view.View
interface OnItemClickListener {
fun onItemClicked(position: Int, view: View)
}
fun RecyclerView.addOnItemClickListener(onClickListener: OnItemClickListener) {
this.addOnChildAttachStateChangeListener(object: RecyclerView.OnChildAttachStateChangeListener {
override fun onChildViewDetachedFromWindow(view: View?) {