-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Implement @ReceiverAction for issue #851 #1092
Conversation
|
I am confused. We already have @receiver for this purpose. |
|
Yeah, but that is for receiver inside of annotations. This works also for receiver that are registred via Manifest |
|
Argh annotations = acticities (or similar) |
|
I see. @yDelouis WDYT? |
|
The idea seems legit seems we added this feature to IntentServices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yDelouis will review your code later, until that i just have on note: i think this is not a functional test. In the functional test project, every annotation should have been tested to see it really does what we think it does. For example in this case we should broadcast an event and check that the annotated methods are indeed called. Also i think we should create another class for these. I know the @Receiver annotation by @yDelouis has similar "functional" test. Actually if we just want to be sure that an annotated code compiles, we should write a compile time test in the androidannotations/src/test folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can confirm that this is not a functional test. i added these methods but as the class (in functional-tests-1-5-tests) that should test this class is missing, i haven't added tests yet. actually it was planned but i forgot about it.
i'll come back to these asap.
|
tests added. |
|
Some nitpick: you do not have to create a separate commits for each file change (but it can be a good thing, if it is really needed). 8000 Read some simple rules about grouping commits. Also do not use too long commit messages and add a detailed description if needed, like this. I will add this information to the contribution page. |
|
@WonderCsabo not sure what exactly you want to tell me.
reads like "do not commit the files seperate. put them togehter"
reads like "do as small commits as possible" about the commit messages i think i understood. :) thank you for your hints. |
|
The main rule is: each commit should have contain one and only one logical change. For example if you add a method in a file, and use it in another file, you should do in the same commit (except if the method is big and/or will be used many other places). But you also should make your commits small. You have to find the balance. :) 6 commits for this feature is clearly too much. |
|
okay.
makes sense so far. i think we should find a better place for these talks. this is nothing that actually should be in a PR and/or a Issue. what about G+ Hangout? |
I agree ;) |
|
any idea what to do with |
|
ok. missing feature: allow the Context being passed to the receiver action. will do that tomorrow! |
We have a similar situation with Actually we could traverse the class hierarchy and find the children of the abstract class, if it has no children we could generate the AA class for it even the class is abstract. But that would look a quiet weird... @yDelouis WDYT? |
|
It seems complicated, the more so as with incremental builds because we have access to modified class only. |
|
@yDelouis do you plan to review this? |
|
rebased on current develop. |
|
Something went wrong during the rebase, because there is a compilation error. |
|
strange... somehow an import got lost. but it should be fixed now. |
|
@yDelouis do you plan to review this? |
|
I have started. I think there should be a handler for the annotation |
|
I know about that comment, that is way i opened #1169. |
Conflicts: AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/InstanceStateHandler.java
Conflicts: AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/InstanceStateHandler.java
|
Thanks for your great work. |
|
I'm glad to see this one merged. :D no need for a custom build anymore.... for now ;) |
|
I also changed a bit how the annotation works. Indeed, you can't let the user put any object in the method because some objects are not Could you please update the wiki page of |
|
wiki updated. but while writing i asked myself if it makes sense to add dataSchemes to this annotation similar to |
|
Please open another issue and explain what would be the generated code. |
|
opened #1176 |
|
Thanks, wiki merged. |
As i got some free time today, i decided to do another contribution to AA. :)
I implemented the @ReceiverAction annotation suggested in #851.
The code is based on the
ServiceActionHandler.This class
genereates the following code