This commit is contained in:
Horis
2025-06-06 09:38:21 +08:00
parent 6f4203c7bb
commit 3cf7e404c2
2 changed files with 6 additions and 2 deletions

View File

@@ -215,6 +215,7 @@ class TextFile(private var book: Book) {
val curChapter = BookChapter()
curChapter.title = matcher.group()
curChapter.start = curOffset + chapterLength
curChapter.end = curChapter.start
toc.add(curChapter)
lastChapterWordCount = 0
} else if (seekPos == 0 && chapterStart != 0) {
@@ -242,6 +243,7 @@ class TextFile(private var book: Book) {
val curChapter = BookChapter()
curChapter.title = matcher.group()
curChapter.start = curOffset + chapterLength
curChapter.end = curChapter.start
toc.add(curChapter)
} else { //否则就block分割之后上一个章节的剩余内容
//获取上一章节
@@ -257,6 +259,7 @@ class TextFile(private var book: Book) {
val curChapter = BookChapter()
curChapter.title = matcher.group()
curChapter.start = lastChapter.end
curChapter.end = curChapter.start
toc.add(curChapter)
}
bookWordCount += chapterContent.length
@@ -275,6 +278,7 @@ class TextFile(private var book: Book) {
val curChapter = BookChapter()
curChapter.title = matcher.group()
curChapter.start = lastChapter.end
curChapter.end = curChapter.start
toc.add(curChapter)
} else { //如果章节不存在则创建章节
val curChapter = BookChapter()

View File

@@ -9,6 +9,7 @@ import android.text.Layout
import android.text.StaticLayout
import android.text.TextPaint
import androidx.core.os.postDelayed
import io.legado.app.constant.AppLog
import io.legado.app.constant.AppPattern
import io.legado.app.constant.EventBus
import io.legado.app.data.entities.Book
@@ -34,7 +35,6 @@ import io.legado.app.utils.postEvent
import io.legado.app.utils.spToPx
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.textHeight
import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.CoroutineScope
import splitties.init.appCtx
import java.util.LinkedList
@@ -1021,7 +1021,7 @@ object ChapterProvider {
visibleBottom = paddingTop + visibleHeight
if (paddingLeft >= visibleRight || paddingTop >= visibleBottom) {
appCtx.toastOnUi("边距设置过大,请重新设置")
AppLog.put("边距设置过大,请重新设置", toast = true)
visibleRect.set(
0f,
0f,