Open FunnyDevs opened 7 years ago
@FunnyDevs it is possible to extend Anvil with custom views, although maybe not like with Anko.
v(MyCustomView.class, () -> {...})
.Anvil.ViewFactory
implementations, register them, and then use them to build custom classes on demand (e.g. if you class constructor is now just View(Context)
, but something more complex, like using styles etc.Starting with Anvil 0.5.0 (just released it today) you may set custom attributes as well, just do attr("myAttr", someValue)
and that will call setMyAttr(someValue)
on your view if fthe value has been changed since the last call. In the worst case that will use reflection, but you may also register your own Anvil.AttributeSetter
to handle your custom attributes and speed up things.
i would like to do like Anko that maps custom function (like toast(), dialog()), but with custom view: customview() Must i do a custom Anvil.ViewFactory???
Is there a changelog of new release???
Thanks
Is possibile a tutorial to extend Anvil with custom views (like Anko)???