This library is not longer maintained. Use android’s native data binding instead.
Introduction
Oxygeroid is an annotation processor for Android which parses XML Layouts and generates classes containing reference to views defined in XML.
Example
For following layout file, Oxygeroid will generate a class with name MainActivityViews (assuming @OxyViews annotation is present on a class named MainActivity) which contains references to all views (having IDs) in layout file.
Add OxyViews annotation.
For the above layout and @OxyViews annotation, oxygeroid will generate the follwing view factory class.
Usage
Step 1
Specify resource package (using @OxyConfig annotation) for refering R from generated classes. @OxyConfig annotation can be added on any class but to make things clear, I would prefer to add it on Application class. e.g.
Step 2
Add @OxyViews annotation with xml file name to generate view factory from that xml. This annotation can only be added to activity classes (if you don’t specify the factory type, see FactoryType). e.g.
Factory Type
@OxyViews without any FactoryType specified, will assume the annotated class, an Activity and will call findViewById method on the instance of that class. It works fine if you annotate an activity with @OxyViews but sometimes we need to pass a root view against which we find views by id.
To address this issue, use @OxyViews with FactoryType,VIEW factory type. Now, the generated class will accept View as an argument and will find view against this (passed as argument) view. e.g.
Skipping a View
Any view with oxyskip tag will be ignore by Oxygeroid i.e. it will not generate view field in generated class.
Custom Class Name
Class name of generated class can be customized by mentioning className in @OxyViews annotation. e.g.
Add to Gradle
Add following lines to your app level dependency block