-
Notifications
You must be signed in to change notification settings - Fork 847
Allow to use Otto with AndroidAnnotations' generated classes. #15
Conversation
…me, that ClassA_ is generated by AA from ClassA.
I'd rather otto do its own code generation. It's not too difficult and we can avoid a third-party dependency. |
We're going to address this soon with code-generation. It also avoids this magic behavior which can lead to undesirable results. |
@JakeWharton, can you please tell, what to expect? |
Just came across this :) . I'm interested in knowing more about that "soon to come code generation". Any pointer :) ? |
Any news about this issue? |
I believe I have run into this issue as well... Using AndroidAnnotations to enhance a fragment, and also to inject several fields (including Otto), I find that despite calling register in the enhanced fragment my @subscribe method does not receive any events. Indeed, all of those events end up in the DeadEvents listener... I had read that in theory as long as AndroidAnnotations does not override the @subscribe annotated method, the events would still get delivered, but it seems they are not. Perhaps this is due to the fragment being created in xml (where you have to reference the EnhancedFragment_ class)? Anyways, very lengthy round about way of saying, I would love for "seamless" integration of Otto and AndroidAnnotations. I'd be happy to help if there is any way I can. |
The next major version of the library will restore superclass |
Ah, fantastic. Thanks Jake! |
Jake, has the superclass |
No, not yet. Haven't had time to work on the code-gen variant which would allow it's restoration without any performance impact. |
If you're willing to work with experimental / unstable stuff, @JakeWharton actually wrote a POC on a branch. Here is a usage example: https://github.com/pyricau/CleanAndroidCode |
AndroidAnnotations now correctly integrates with Otto, see androidannotations/androidannotations#526 |
Is it fixed in AA 2.7.1? Or is it fixed in latest Otto release? |
Great !!!!!!!!!!!!!! |
abort post early if bus is destroyed
There is a problem using https://github.com/excilys/androidannotations with Otto. When we pass
this
to Otto, it can see generated by AA class, which doesn't have any@Subscribe
and@Produce
annotations.The first solution is to wrap all annotated methods on ClassA_ in the AndroidAnnotations project, something like this:
Generated class could be:
We use wrappers for methods to call
this.onMyEvent
which could be overriden inClassActivity_
But it is rather complicated to generate lots of code. The easiest way is to modify Otto a bit. We assume, that ClassA_ is generated by AA from ClassA.