Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed May 12, 2022
1 parent e8ecbfc commit c043ea7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/io/legado/app/model/CacheBook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ object CacheBook {

class CacheBookModel(var bookSource: BookSource, var book: Book) {

private val waitDownloadSet = hashSetOf<Int>()
private val onDownloadSet = hashSetOf<Int>()
private val successDownloadSet = hashSetOf<Int>()
private val waitDownloadSet = linkedSetOf<Int>()
private val onDownloadSet = linkedSetOf<Int>()
private val successDownloadSet = linkedSetOf<Int>()
private val errorDownloadMap = hashMapOf<Int, Int>()

val waitCount get() = waitDownloadSet.size
Expand Down Expand Up @@ -174,7 +174,7 @@ object CacheBook {
}
onDownloadSet.remove(index)
//重试3次
if (errorDownloadMap[index] ?: 0 < 3) {
if ((errorDownloadMap[index] ?: 0) < 3) {
waitDownloadSet.add(index)
} else {
AppLog.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapt
}
}
mLayoutManager.scrollToPositionWithOffset(scrollPos, 0)
adapter.upDisplayTitle(scrollPos)
adapter.upDisplayTitles(scrollPos)
}
}

override fun clearDisplayTitle() {
adapter.clearDisplayTitle()
adapter.upDisplayTitle(mLayoutManager.findFirstVisibleItemPosition())
adapter.upDisplayTitles(mLayoutManager.findFirstVisibleItemPosition())
}

override val scope: CoroutineScope
Expand Down

0 comments on commit c043ea7

Please sign in to comment.