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.
StickyListHeadersListView has build error with AA 4.1.0 #1845
When i have an object which like:
@ViewById
StickyListHeadersListView lvStickyList;
and then i set it ItemClick as below:
@ItemClick(R.id.lvStickyList)
void itemClick(int position) {
It will cause build error as
error: incompatible types: StickyListHeadersListView cannot be converted to AdapterView
((AdapterView ) this.lvStickyList).setOnItemClickListener(new OnItemClickListener() {
...
Maybe it is a side effect by #1785 Cast views to the required type when adding callbacks.
Any solution for this? Thx.
Well, after i traced the source code of AA, i think it is very hard to support customize view gracefully...
But so many projects used third-party customize view, so if you make sure AA doesn't support it,
maybe should be written in 4.1 documents or use instanceof to check these views could cast to AdapterView or not.
I am closing this one, as i think we should put effort into supporting some ListView-ish classes, as development moved to the much robust RecyclerView class.
Activity
dodgex commentedon Oct 10, 2016
first of all sorry for the late response.
yeah this is indeed a side effect of #1785. unfortunately I currently have no idea for a good fix.
one possible way is to allow a class parameter to the annotation to specify the class to be used for the cast.
e.g.
and then generate the cast like
but this does not feel clean... @WonderCsabo do you have an idea how to fix this issue?
WonderCsabo commentedon Oct 10, 2016
The
castToparameter is horrible. However i am not sure why this error is happening. Why the class cannot be cast to its parent class? 😕dodgex commentedon Oct 10, 2016
StickyListHeadersListViewis not a child ofAdapterViewand I'm pretty sure this is also true forPullToRefreshListViewmentioned in #1871WonderCsabo commentedon Oct 10, 2016
I am not sure we want to support these badly designed fake
ListViewclasses.TomWangTW commentedon Oct 11, 2016
Well, after i traced the source code of AA, i think it is very hard to support customize view gracefully...
But so many projects used third-party customize view, so if you make sure AA doesn't support it,
maybe should be written in 4.1 documents or use instanceof to check these views could cast to AdapterView or not.
WonderCsabo commentedon Nov 23, 2016
I am closing this one, as i think we should put effort into supporting some
ListView-ish classes, as development moved to the much robustRecyclerViewclass.