etsy / AndroidStaggeredGrid

An Android staggered grid view which supports multiple columns with rows of varying sizes.
https://github.com/etsy/AndroidStaggeredGrid
4.76k stars 1.13k forks source link

Staggered listview were broken when I reinstantiate. #185

Open kyungin-park opened 9 years ago

kyungin-park commented 9 years ago

When I called resetToTop of StaggeredGridView, listview positions were broken. I finally found what is the cause of the problem and I am sharing with you guys to prevent having the same problem.

On ExpendableListView.java file,

private void clearState() {
    ....
    mDataChanged = true; <----- Here should be true...
    .....
}

public void resetToTop() {
    // I added the reinitiation below.
    clearState();
    invokeOnItemScrollListener();
}

On StaggeredGridView.java file,

@Override
public void resetToTop() {
    // I added the super call below.
    super.resetToTop();
    ....
}

I found some critical bugs which are not found by others. It's little bit strange... why only to me.... It seems that the reason why I have lots of exceptions unlike that other people don't have is that my loading speed is little more delayed than usual usages. That makes some differences to draw and calculate the staggered listview. Um... And I don't know if my corrections are perfectly correct or not, but it works in my logic at least... And I discovered one more bug staggered position became to the same bottom when I scroll it fast. I will look into the reason someday because I am busy with working... T_T If anyone found these bugs I found, please update it. please solve it together to make it better~