Tuesday 18 October 2016

AirCycle

Binds Android Activity lifecycle callbacks to Activity fields annotated with @AirCycle.

Fields annotated with @AirCycle that are defined in an Activity will receive lifecycle callbacks of the enclosing Activity. The Activity does NOT need to implement any interface or extend any specific base class.

The field itself also does NOT need to implement any interface or extend any specific base class.

The binding class is generated in compile time using Java annotation processing, NO reflection is used at runtime. Since all classes are generated in compile time, it can safely be used with ProGuard.

Inspired by SoundCloud's LightCycle library. Compared to LightCycle, AirCycle supports passing of Activity lifecycle callbacks without the need to extend from a specific base Activity. Additionally, the listener classes are completely flexible, without the need to extend from any class or interface. This enables more flexibility when developing and further promotes composition over inheritance.



from The Android Arsenal

No comments:

Post a Comment