Do readaround, not readahead

This commit is contained in:
tarsin authored and GitHub committed 2023-02-06 23:18:10 +08:00
1 parent 82ebfb99c5
commit e48f19269f
1 file changed
+1 -1
@@ -46,7 +46,7 @@ abstract class PageLoader {
// val pagesAbsent = (index until (mPreloads + index).coerceAtMost(size())).toMutableList().removeAll(mImageCache.snapshot().keys)
// Should we refresh our LruCache ?
val pagesAbsent = (index until (mPreloads + index).coerceAtMost(size())).mapNotNull { it.takeIf { mImageCache[it] == null } }
val pagesAbsent = ((index - 5).coerceAtLeast(0) until (mPreloads + index).coerceAtMost(size())).mapNotNull { it.takeIf { mImageCache[it] == null } }
preloadPages(pagesAbsent)
}