优化
This commit is contained in:
@@ -131,9 +131,9 @@ object CacheBook {
|
|||||||
|
|
||||||
class CacheBookModel(var bookSource: BookSource, var book: Book) {
|
class CacheBookModel(var bookSource: BookSource, var book: Book) {
|
||||||
|
|
||||||
private val waitDownloadSet = hashSetOf<Int>()
|
private val waitDownloadSet = linkedSetOf<Int>()
|
||||||
private val onDownloadSet = hashSetOf<Int>()
|
private val onDownloadSet = linkedSetOf<Int>()
|
||||||
private val successDownloadSet = hashSetOf<Int>()
|
private val successDownloadSet = linkedSetOf<Int>()
|
||||||
private val errorDownloadMap = hashMapOf<Int, Int>()
|
private val errorDownloadMap = hashMapOf<Int, Int>()
|
||||||
|
|
||||||
val waitCount get() = waitDownloadSet.size
|
val waitCount get() = waitDownloadSet.size
|
||||||
@@ -174,7 +174,7 @@ object CacheBook {
|
|||||||
}
|
}
|
||||||
onDownloadSet.remove(index)
|
onDownloadSet.remove(index)
|
||||||
//重试3次
|
//重试3次
|
||||||
if (errorDownloadMap[index] ?: 0 < 3) {
|
if ((errorDownloadMap[index] ?: 0) < 3) {
|
||||||
waitDownloadSet.add(index)
|
waitDownloadSet.add(index)
|
||||||
} else {
|
} else {
|
||||||
AppLog.put(
|
AppLog.put(
|
||||||
|
|||||||
@@ -136,13 +136,13 @@ class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mLayoutManager.scrollToPositionWithOffset(scrollPos, 0)
|
mLayoutManager.scrollToPositionWithOffset(scrollPos, 0)
|
||||||
adapter.upDisplayTitle(scrollPos)
|
adapter.upDisplayTitles(scrollPos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun clearDisplayTitle() {
|
override fun clearDisplayTitle() {
|
||||||
adapter.clearDisplayTitle()
|
adapter.clearDisplayTitle()
|
||||||
adapter.upDisplayTitle(mLayoutManager.findFirstVisibleItemPosition())
|
adapter.upDisplayTitles(mLayoutManager.findFirstVisibleItemPosition())
|
||||||
}
|
}
|
||||||
|
|
||||||
override val scope: CoroutineScope
|
override val scope: CoroutineScope
|
||||||
|
|||||||
Reference in New Issue
Block a user