FabianTerhorst / FastLayout

Generates a Java Object for your xml layout to reduce inflate time to zero
Apache License 2.0
443 stars 35 forks source link

Working around custom attributes #7

Closed ozodrukh closed 8 years ago

ozodrukh commented 8 years ago

I tried to invent this project weeks ago, but i gave up because of custom attributes support, as you started i wish i could help you in development if i find time.

Anyway we could not support custom attributes. What can we do? Give an interface to call custom methods in order to setup and notify user that we don't support them overtime he mades changes in the layout

FabianTerhorst commented 8 years ago

@ozodrukh for custom attributes i had the idea to add converters with annotations. For example https://github.com/FabianTerhorst/FastLayout/blob/master/app/src/main/java/io/fabianterhorst/fastlayout/sample/MyLayoutConverter.java . But the reflection to init the converter class doesn´t work right now.https://github.com/FabianTerhorst/FastLayout/blob/master/fastlayout-processor/src/main/java/io/fabianterhorst/fastlayout/processor/LayoutProcessor.java#L107

Alexander-- commented 8 years ago

I tried to invent this project weeks ago, but i gave up because of custom attributes support, as you started i wish i could help you in development if i find time.

Same here. I have been continuously coming with all kinds of workarounds, but gave up after realising, that…

All of that solely to combat AssetManager.

Nevertheless, good luck with this project.

…for custom attributes i had the idea to add converters with annotations… But the reflection to init the converter class doesn´t work right now.

@FabianTerhorst Have you considered using ServiceLoader?

Forget that, I have just recalled seeing less roundabout solution in other library. I will elaborate in #10.

FabianTerhorst commented 8 years ago

@Alexander-- have you also tried to create a XmlBlock.Parser with reflection?

FabianTerhorst commented 8 years ago

@Alexander-- but im sure setting a theme programatically should work. I will try to find a solution for this.

FabianTerhorst commented 8 years ago

@Alexander-- themes should working now.