zain
05/19/2021, 8:27 AMthis
within a lambda expression
val sectionChildAdapter = SectionChildAdapter {
callBackListener.invoke(it)
this.notify(l)
}
Marius Metzger
05/19/2021, 8:43 AMclass MyClass {
fun myFun() {
val sectionChildAdapter = SectionChildAdapter {
callBackListener.invoke(it)
this@MyClass.notify(l)
}
}
}
Marius Metzger
05/19/2021, 8:44 AMcallBackListener.invoke(it)
, just do callBackListener(it)
😉zain
05/19/2021, 8:45 AMMarius Metzger
05/19/2021, 8:48 AMthis
then.Marius Metzger
05/19/2021, 8:48 AMcallBackListener
with an implicit this
zain
05/19/2021, 8:49 AMMarius Metzger
05/19/2021, 8:49 AMthis@SectionChildAdapter
zain
05/19/2021, 8:51 AMMarius Metzger
05/19/2021, 8:57 AMval adapter = object : SectionChildAdapter {
override fun onChildChange(item: SectionChildItem<*>) {
callBackListener(it)
this.notify(l)
}
}
zain
05/19/2021, 8:57 AMzain
05/19/2021, 8:57 AMNikky
05/19/2021, 5:08 PMprivate val callBackListener: SectionChildAdapter.(SectionChildItem<*>) -> Unit
and call it like so
adapter.callbackListener(item)
zain
05/21/2021, 10:08 AMzain
05/21/2021, 10:10 AM