Cleanup toMutable* usage

This commit is contained in:
tarsin committed 2023-07-03 18:37:50 +08:00
1 parent 802b63ed5a
commit 975421044c
3 files changed
+4 -12

No files matched your search

@@ -53,7 +53,7 @@ object DownloadManager : OnSpiderListener {
private val map: MutableMap<String?, LinkedList<DownloadInfo>>
// All labels without default label
val labelList: MutableList<DownloadLabel> = EhDB.allDownloadLabelList.toMutableList()
val labelList = EhDB.allDownloadLabelList as MutableList<DownloadLabel>
// Store download info with default label
val defaultInfoList: LinkedList<DownloadInfo>
@@ -547,7 +547,7 @@ class GalleryListScene : SearchBarScene(), OnDragHandlerListener, OnClickFabList
drawerBinding.recyclerViewDrawer.visibility = View.GONE
}
lifecycleScope.launchIO {
mQuickSearchList = EhDB.allQuickSearch.toMutableList()
mQuickSearchList = EhDB.allQuickSearch as MutableList<QuickSearch>
if (mQuickSearchList.isNotEmpty()) {
withUIContext {
drawerBinding.tip.visibility = View.GONE
@@ -49,16 +49,8 @@ abstract class PageLoader {
onRequest(index)
}
// val pagesAbsent = (index until (mPreloads + index).coerceAtMost(size())).toMutableList().removeAll(mImageCache.snapshot().keys)
// Should we refresh our LruCache ?
val pagesAbsent =
((index - 5).coerceAtLeast(0) until (mPreloads + index).coerceAtMost(size)).mapNotNull { it.takeIf { mImageCache[it] == null } }
preloadPages(
pagesAbsent,
(index - 10).coerceAtLeast(0) to (mPreloads + index + 10).coerceAtMost(
size,
),
)
val pagesAbsent = ((index - 5).coerceAtLeast(0) until (mPreloads + index).coerceAtMost(size)).mapNotNull { it.takeIf { mImageCache[it] == null } }
preloadPages(pagesAbsent, (index - 10).coerceAtLeast(0) to (mPreloads + index + 10).coerceAtMost(size))
}
fun retryPage(index: Int) {