Update ReadBook.kt

优化
pull/1123/head
bushixuanqi 3 years ago committed by GitHub
parent 53f9e4ca42
commit 0871341b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      app/src/main/java/io/legado/app/service/help/ReadBook.kt

@ -415,30 +415,22 @@ object ReadBook {
else -> chapter.title
}
val contents = contentProcessor!!.getContent(book, chapter.title, content)
when (chapter.index) {
durChapterIndex -> {
curTextChapter =
ChapterProvider.getTextChapter(
book, chapter, contents, chapterSize
)
if (upContent) callBack?.upContent(resetPageOffset = resetPageOffset)
val textChapter = ChapterProvider.getTextChapter(book, chapter,contents,chapterSize)
val offset = chapter.index - durChapterIndex
if (upContent) callBack?.upContent(offset ,resetPageOffset)
when (offset) {
0 -> {
curTextChapter = textChapter
callBack?.upView()
curPageChanged()
callBack?.contentLoadFinish()
}
durChapterIndex - 1 -> {
prevTextChapter =
ChapterProvider.getTextChapter(
book, chapter, contents, chapterSize
)
if (upContent) callBack?.upContent(-1, resetPageOffset)
- 1 -> {
prevTextChapter = textChapter
}
durChapterIndex + 1 -> {
nextTextChapter =
ChapterProvider.getTextChapter(
book, chapter, contents, chapterSize
)
if (upContent) callBack?.upContent(1, resetPageOffset)
1 -> {
nextTextChapter = textChapter
}
}
}
@ -501,4 +493,4 @@ object ReadBook {
fun upPageAnim()
}
}
}

Loading…
Cancel
Save