预下载章节可调整数目

pull/978/head
gedoor 4 years ago
parent 5b40199891
commit 05895aa4b8
  1. 8
      app/src/main/java/io/legado/app/service/help/ReadBook.kt

@ -140,8 +140,8 @@ object ReadBook {
loadContent(durChapterIndex.plus(1), upContent, false) loadContent(durChapterIndex.plus(1), upContent, false)
GlobalScope.launch(Dispatchers.IO) { GlobalScope.launch(Dispatchers.IO) {
val maxChapterIndex = val maxChapterIndex =
min(chapterSize, durChapterIndex + AppConfig.preDownloadNum) min(chapterSize - 1, durChapterIndex + AppConfig.preDownloadNum)
for (i in 2 until maxChapterIndex) { for (i in 2..maxChapterIndex) {
delay(1000) delay(1000)
download(durChapterIndex + i) download(durChapterIndex + i)
} }
@ -172,8 +172,8 @@ object ReadBook {
loadContent(durChapterIndex.minus(1), upContent, false) loadContent(durChapterIndex.minus(1), upContent, false)
GlobalScope.launch(Dispatchers.IO) { GlobalScope.launch(Dispatchers.IO) {
val maxChapterIndex = val maxChapterIndex =
min(chapterSize, durChapterIndex + AppConfig.preDownloadNum) min(chapterSize - 1, durChapterIndex + AppConfig.preDownloadNum)
for (i in 2 until maxChapterIndex) { for (i in 2..maxChapterIndex) {
delay(1000) delay(1000)
download(durChapterIndex - i) download(durChapterIndex - i)
} }

Loading…
Cancel
Save