Set page status to QUEUE if its image needs update

Old image was recycled due to cache eviction
This commit is contained in:
FooIbar authored and tarsin committed 2023-02-21 08:56:30 +08:00
1 parent 53f2c7126b
commit 25500da486
2 files changed
+4 -3

No files matched your search

@@ -78,7 +78,6 @@ class ArchivePageLoader(context: Context, uri: Uri, passwdFlow: Flow<String>) :
private val mSemaphore = Semaphore(4)
override fun onRequest(index: Int) {
notifyPageWait(index)
synchronized(mJobMap) {
val current = mJobMap[index]
if (current?.isActive != true) {
@@ -36,10 +36,12 @@ abstract class PageLoader {
fun request(page: ReaderPage) {
val index = mPages.indexOf(page)
val image = mImageCache[index]
if (image != null)
if (image != null) {
notifyPageSucceed(index, image)
else
} else {
page.status.value = Page.State.QUEUE
onRequest(index)
}
// val pagesAbsent = (index until (mPreloads + index).coerceAtMost(size())).toMutableList().removeAll(mImageCache.snapshot().keys)
// Should we refresh our LruCache ?