Skip to content

Commit

Permalink
item click listener dsl
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZyLegenD committed Jun 17, 2019
1 parent 5ce6bb0 commit 7dfc4ef
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ import android.view.View
*/
interface forItemClickListener<T> {
fun forItem(position:Int, item:T, purpose:ClickPurpose, view: View)
}
}

fun <T> forItemClickListenerDSL(callback: (position: Int, item: T, purpose: ClickPurpose, view: View) -> Unit = { _, _, _, _ -> }): forItemClickListener<T> {
return object : forItemClickListener<T> {
override fun forItem(position: Int, item: T, purpose: ClickPurpose, view: View) {
callback(position, item, purpose, view)
}
}
}

0 comments on commit 7dfc4ef

Please sign in to comment.