declex icon indicating copy to clipboard operation
declex copied to clipboard

Create listeners anntations for the views automatacally

Open smaugho opened this issue 7 years ago • 0 comments

In AndroidAnnotation, per each listener an annotation should be crated, in general, the task of creating those annotations it is highly time consuming, but basically, all of them do the same.

It would be great if these events for the views are created automatically, for instance, in AA you have

@Click
void someMethod() {}

@Touch
void someMethod() {}

But these annotations do exactly the same, it binds the method "someMethod" to the event through a method named "setOnClickListener". This format for methods is used for almost every object in Android Framework, and it is also kept by many 3rd party libraries.

DecleX could interact through the layouts and depending on the elements used, create automatically these annotations to bind to the event. It is just a question of finding the methods "setOn<AnnotaitonName>Listener", maybe others formats can be applied. The annotations are then created at runtime, and they are "annotated" by something that DecleX will process the first, and will add all those annotations to be processed by the same handler (or some collections of Handlers, for instance, for lists annotations, there can be some variations).

After this, automatically all the events of the system will be available for the user, and many 3rd parties libraries event listeners (when using some View in a library) would be set in the same way.

smaugho avatar May 23 '17 10:05 smaugho