be explicit about the current scrolling position

Jump to top if we have no LRU cache entry
This commit is contained in:
Adrian Ulrich 2017-02-17 22:17:46 +01:00
parent 7240b0089f
commit 5e8f9bbef6

View File

@ -652,11 +652,14 @@ public class LibraryPagerAdapter
int index = message.arg1;
mAdapters[index].commitQuery(message.obj);
// Restore scrolling position if present and valid
Integer curPos = sLruAdapterPos.popPosition(mAdapters[index]);
if (curPos != null && curPos < mLists[index].getCount())
mLists[index].setSelection(curPos);
if (curPos == null || curPos >= mLists[index].getCount()) {
// we got no cached data or it is out of bounds
curPos = 0;
}
// curPos is now either 0 or a cached position -> jump to this position
mLists[index].setSelection(curPos);
break;
}
case MSG_SAVE_SORT: {