-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add @Result annotation for @OnActivityResult #1058
Add @Result annotation for @OnActivityResult #1058
Conversation
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.
Please, add some javadoc on the annotation. See existing annotations to have some examples.
|
You must create a class @OnActivityResult
public void onOneResult(@Result int value, @Result("value") String str) {
...
} |
|
Thank you for your advice. I added some comments and created |
|
Ideally you should create a subclass of |
|
@WonderCsabo @yDelouis while i understand the fact that one handler should only handle one annotation, i wonder if there are not some cases, where it would make sense to handle more. this case here is imho the same situation as in my @ReceiverAction PR. the values/parameters are directly related to the actual annotation that has to be handled, and it has an direct impact on how the generated code should look. in such a case, i would not add the just my 2¢ |
|
Yeah, you have a point, although i do not really think ReceiverAction is |
ReceiverAction has a param annotation too. it is used to map extras like |
|
Yeah, i just found that, i did not notice when i opened the diff on my mobile phone. You are right, this is the same case, but i am not sure @yDelouis will not tell you the same when he will review your PR. :) I think this is an important design decision, @yD 8000 elouis, @DayS WDYT? |
|
This is indeed an important decision because it is the first time we deal with a param annotation and it will happen more and more.
|
|
I agree, we should prepare the framework to handle param annotations. We should create a new parent class for these kind of handlers. Also we have to modify |
|
Thanks. We have to update the wiki (list of all annotations and onActivityResult page) about that. @simonz, could you clone the wiki and update it in your fork so that we will be able to pull it ? |
|
I added the doc. |
This PR is implementing #796 which I really wanted to be implemented
@Resultis added to retrieve the values from intentthis is a snippet from a generated code.
extras_was newly declared and one block was added for variable's scope