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.
Here #1162 (comment)@dodgex suggested to allow the subclass as a parameter. I think it would be very convenient to allow this for other listener annotations and other parameters.
@yDelouis WDTY? If it is a good idea we should review all params of all listener annotations and decide where it makes sense to allow subclass as param type.
// old way@ClickvoidmyButtonClicked(Viewview) {
ButtonmyButton = (Button) view;
// do sg with myButton
}
// new way@ClickvoidmyButtonClicked(Buttonview) {
// do sg with view
}
So it removes the need of casting as @ViewById does.
What do you mean the right class? We cannot know what is the actual type of the object, this is the responsibility of the client. Just like with @ViewById.
Activity
yDelouis commentedon Dec 25, 2014
I don't understand the comment and how it can help. Could you write an example ?
WonderCsabo commentedon Dec 25, 2014
Of course:
So it removes the need of casting as
@ViewByIddoes.yDelouis commentedon Dec 25, 2014
OK. How do we validate that the given view(s) have the right class ? And do we do when it is not the case ?
WonderCsabo commentedon Dec 25, 2014
What do you mean the right class? We cannot know what is the actual type of the object, this is the responsibility of the client. Just like with
@ViewById.yDelouis commentedon Dec 25, 2014
You're right, it will just fail at runtime. I'm totally ok with that so.
WonderCsabo commentedon Dec 25, 2014
This is blocked by #1284.
Migrate param validation to new API
WonderCsabo commentedon May 5, 2015
No longer blocked.
WonderCsabo commentedon Jun 4, 2015
This is now implemented for the most event binding annotations. If you need it for the rest, please open a new issue.