Hi,
I have a few lambda expression already. But I try to add one for android:onLongClick. But the build fails
error: cannot generate view binders java.lang.StackOverflowError
at android.databinding.tool.writer.LayoutBinderWriterKt$callbackLocalName$2.invoke(LayoutBinderWriter.kt)
at android.databinding.tool.writer.LayoutBinderWriterKt$callbackLocalName$2.invoke(LayoutBinderWriter.kt)
at android.databinding.tool.ext.LazyExt.getValue(ext.kt:27)
at android.databinding.tool.writer.LayoutBinderWriterKt.getCallbackLocalName(LayoutBinderWriter.kt)
at android.databinding.tool.writer.LayoutBinderWriterKt.scopedName(LayoutBinderWriter.kt:200)
at android.databinding.tool.expr.Expr.toCode(Expr.java:739)
at android.databinding.tool.writer.LayoutBinderWriterKt$callbackLocalName$2.invoke(LayoutBinderWriter.kt:206)
at android.databinding.tool.writer.LayoutBinderWriterKt$callbackLocalName$2.invoke(LayoutBinderWriter.kt)
at android.databinding.tool.ext.LazyExt.getValue(ext.kt:27)
at android.databinding.tool.writer.LayoutBinderWriterKt.getCallbackLocalName(LayoutBinderWriter.kt)
at android.databinding.tool.writer.LayoutBinderWriterKt.scopedName(LayoutBinderWriter.kt:200)
at android.databinding.tool.expr.Expr.toCode(Expr.java:739)
…you get the picture
Now in the layout I have the activity bound and try to set android:onLongClick, this should be supported
<data>
<variable name="context" type="letstwinkle.com.twinkle.ProspectsActivity" />
<variable name="quiz" type="letstwinkle.com.twinkle.model.ProspectQuiz" />
</data>
<TextView
android:onLongClick="@{() -> context.quizLongClicked(quiz)}"
/>
I bind this attribute in one other layout like this:
android:onLongClick="@{activity::matchPlayAvatarLongPressed}"
So seems like method reference is OK, but Kotline not handling a lambda properly for a synthetic attribute? Plus similar expression for android:onClick works.