You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
I'm using Otto, the bus library from square. I have a couple of methods annotated with @subscribe, which is part of Otto.
When I add @trace, it appears that the @subscribe annotation isn't carried over, so when I post events those methods listen for, nothing happens. When I remove @trace, they fire off as expected.
Just FYI, I wound up taking a look at the code generated for the LoginTask_. I ended up dropping the annotations and creating my own version that doesn't hold a reference to the Context (Activity). Might be worthwhile to have @background(useContext = false) or something.
I switched to EventBus, which supposedly has better performance, since it doesn't rely on annotations. I forgot to add a call to register in onCreate, which may have been a problem too.
Just wondering.. do you guys think it'd be interesting to reproduce Otto features in AndroidAnnotations ? Either write an integration layer, or reproduce the features with compile time generation of the features (no class parsing) ?
Thinking about a compile time bus event, here are the features I'd see :
@Subscribe and @Produces usage would lead to automatic registration of associated instances. This means, however, that lifecycle must be handled careful (ie register in onResume() and unregister in onPause()).
Then you need to be able to inject a bus instance. Whether there should be only one bus instance, or multiple onces with identifiers, is also a good question.
Activity
mandrachek commentedon Jul 13, 2012
Just FYI, I wound up taking a look at the code generated for the LoginTask_. I ended up dropping the annotations and creating my own version that doesn't hold a reference to the Context (Activity). Might be worthwhile to have @background(useContext = false) or something.
naixx commentedon Jul 27, 2012
@mandrachek btw, how did you manage to register your
LoginActivity?LoginActivity_should not have any@Subscribeannotations, as I understandnaixx commentedon Jul 28, 2012
You can check square/otto#15
It is easier in Otto to fix this
mandrachek commentedon Jul 29, 2012
I switched to EventBus, which supposedly has better performance, since it doesn't rely on annotations. I forgot to add a call to register in onCreate, which may have been a problem too.
pyricau commentedon Aug 9, 2012
Just wondering.. do you guys think it'd be interesting to reproduce Otto features in AndroidAnnotations ? Either write an integration layer, or reproduce the features with compile time generation of the features (no class parsing) ?
Thinking about a compile time bus event, here are the features I'd see :
@Subscribeand@Producesusage would lead to automatic registration of associated instances. This means, however, that lifecycle must be handled careful (ie register inonResume()and unregister inonPause()).Then you need to be able to inject a bus instance. Whether there should be only one bus instance, or multiple onces with identifiers, is also a good question.
romainpiel commentedon Feb 19, 2013
I know it's an old entry but I'd love this to be integrated to Android Annotations.
pyricau commentedon Feb 27, 2013
Me too :)
pyricau commentedon Feb 27, 2013
I think we shouldn't reimplement this, but just use Otto, which works fine.
A future version of Otto is supposed to work with annotation processing. But it's not there yet, and I don't know if it will come for sure.
In the meantime, the only thing we need to do is to override the annotated methods in the generated subclass and delegate the calls to super.
Note: I updated the title of this issue
Otto integration: @subscribe & @produce methods are overriden to enab…
romainpiel commentedon Mar 5, 2013
Interesting! Now I'm using EventBus but I could switch to Otto as it's coming with aa