felipecsl/QuickReturn

Quick Return broken when calling ListView.onRestoreInstanceState(state)

Closed this issue · 1 comments

if we initialize Quick Return with the listview and then call listview.onRestoreInstanceState(state) which will make the list view restore it previous instance (scroll to last value). The QuickReturnTarget will become unstable and will hide/show randomly when scroll up or down.

Anyone has solution for this?

Hi after investigate , i have found the solution. If you init a listview with adapter and use listview.onRestoreInstanceState(state) to scroll to the last position. You must interator through the set of QuickReturnAdapter to recalculate itemsVerticalOffset array from index 0

//re calulate all item offset one time
public void reCalculateAllApdapter()
{
int mItemCount = quickReturnAdapter.getCount();
for (int i = 0; i < mItemCount; ++i) {
quickReturnAdapter.getView(i, null, listView);
}
}