pull/1155/head
gedoor 3 years ago
parent 7ede071d5c
commit ec9e19f274
  1. 9
      app/src/main/java/io/legado/app/service/help/ReadBook.kt

@ -27,7 +27,6 @@ import kotlin.math.min
object ReadBook { object ReadBook {
var titleDate = MutableLiveData<String>() var titleDate = MutableLiveData<String>()
var book: Book? = null var book: Book? = null
var contentProcessor: ContentProcessor? = null
var inBookshelf = false var inBookshelf = false
var chapterSize = 0 var chapterSize = 0
var durChapterIndex = 0 var durChapterIndex = 0
@ -46,7 +45,6 @@ object ReadBook {
fun resetData(book: Book) { fun resetData(book: Book) {
this.book = book this.book = book
contentProcessor = ContentProcessor.get(book.name, book.origin)
readRecord.bookName = book.name readRecord.bookName = book.name
readRecord.readTime = appDb.readRecordDao.getReadTime(book.name) ?: 0 readRecord.readTime = appDb.readRecordDao.getReadTime(book.name) ?: 0
durChapterIndex = book.durChapterIndex durChapterIndex = book.durChapterIndex
@ -414,9 +412,10 @@ object ReadBook {
2 -> ChineseUtils.s2t(chapter.title) 2 -> ChineseUtils.s2t(chapter.title)
else -> chapter.title else -> chapter.title
} }
val contents = contentProcessor!!.getContent(book, chapter.title, content) val contents = ContentProcessor.get(book.name, book.origin)
val textChapter = .getContent(book, chapter.title, content)
ChapterProvider.getTextChapter(book, chapter, contents, chapterSize) val textChapter = ChapterProvider
.getTextChapter(book, chapter, contents, chapterSize)
val offset = chapter.index - durChapterIndex val offset = chapter.index - durChapterIndex
if (upContent) callBack?.upContent(offset, resetPageOffset) if (upContent) callBack?.upContent(offset, resetPageOffset)

Loading…
Cancel
Save