From 111b2d90f0944c3c236dcf0daa1b08bc5caa3fe3 Mon Sep 17 00:00:00 2001 From: Adrian Ulrich Date: Sat, 18 Feb 2017 10:44:41 +0100 Subject: [PATCH] Revert "be explicit about the current scrolling position" This reverts commit 5e8f9bbef6348926d5790c473c9cea1eae398896. --- .../android/vanilla/LibraryPagerAdapter.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ch/blinkenlights/android/vanilla/LibraryPagerAdapter.java b/src/ch/blinkenlights/android/vanilla/LibraryPagerAdapter.java index 069bd669..b5d1f2ff 100644 --- a/src/ch/blinkenlights/android/vanilla/LibraryPagerAdapter.java +++ b/src/ch/blinkenlights/android/vanilla/LibraryPagerAdapter.java @@ -652,14 +652,11 @@ 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()) { - // we got no cached data or it is out of bounds - curPos = 0; - } + if (curPos != null && curPos < mLists[index].getCount()) + mLists[index].setSelection(curPos); - // curPos is now either 0 or a cached position -> jump to this position - mLists[index].setSelection(curPos); break; } case MSG_SAVE_SORT: {