I'm successfully able to have epoxy generate code from this EpoxyModelClass
@EpoxyModelClass(layout = R.layout.card_sample)
abstract class PhotoModel : EpoxyModelWithHolder<PhotoModel.Holder>() {
@EpoxyAttribute
var title: String? = null
override fun bind(holder: PhotoModel.Holder) {
holder.header.text = title
}
class Holder : EpoxyHolder() {
override fun bindView(itemView: View) {
header = itemView.findViewById(R.id.header_label)
}
lateinit var header: TextView
}
}
but unfortunately not from a ModelView
. It builds without errors, but no generated epoxy classes around this:
@ModelView
abstract class HeaderView : LinearLayout {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
context,
attrs,
defStyle
)
private var titleProp: CharSequence? = null
@TextProp(defaultRes = R.string.app_name)
fun setTitle(title: CharSequence) {
titleProp = title
}
}
Tried many variations on this to get it right but there are no helpful errors in build logs.
Using
open
on both functions and class instead ofabstract
seems to work.