Open JamieHibbard opened 11 years ago
I suggest that overrides the setAdapter function, register data set observer, when observer the data set changed, reset parameters for computeScrollY.
@Override
public void setAdapter(ListAdapter adapter){
super.setAdapter(adapter);
adapter.registerDataSetObserver(new DataSetObserver(){
public void onChanged() {
reset();
}
});
}
I am using Endless Adapter from Commons Guy. The dataset on my listadapter is changing lots of time when I scroll. Overriding setAdapter works for me but it makes the QuickReturnView flinging.
@tasomaniac did you find any solution ??? i am facing the same problem as you . did you get rid of it ?
Not only is setAdapter a problem: also on adapter.notifiyDataSetChanged() everything needs to be re-computed! Plus: iterating over ALL items in the list and invoke getView - that is practically a seriously bad idea. There's a reason that the ListView itself recycles views and never ever lets getView run for each and every item in the list at once!
Any thoughts on that?
I think you have explained the real problem in a very good way.
Basically all the height of all the cells has to be computed. All of my rows have the same height. So I just get that height from the dimensions resource and make this for loop very fast and dynamic. On Mar 27, 2014 2:10 PM, "Zordid" notifications@github.com wrote:
Not only is setAdapter a problem: also on adapter.notifiyDataSetChanged() everything needs to be re-computed! Plus: iterating over ALL items in the list and invoke getView - that is practically a seriously bad idea. There's a reason that the ListView itself recycles views and never ever lets getView run for each and every item in the list at once!
Any thoughts on that?
Reply to this email directly or view it on GitHubhttps://github.com/LarsWerkman/QuickReturnListView/issues/3#issuecomment-38795109 .
There are some other huge flaws inside the code as well: Why is getComputedScroll() assuming that there are ANY items? It just states
view = getChildAt(0) and accesses view.getTop() immediately without null-check...
This should not be advertised as a library... sorry.
@Zordid Yup, having the same problem as well. Don't think this is a library, just an example implementation. Does anyone know of an actual library that does the quick return ?
This library worked great for me
Great work,
However when I was calling, setAdaptor once it has computedY it was erroring.
I have a button that allows people to add a new row.
The way round i found was to reset all varibles within QuickReturnListView.java
and call it before using setadaptor. This then recalculates without having to reload.
Thought i'd post incase someone has another idea or it helps someone