优化
This commit is contained in:
@@ -215,6 +215,7 @@ class TextFile(private var book: Book) {
|
|||||||
val curChapter = BookChapter()
|
val curChapter = BookChapter()
|
||||||
curChapter.title = matcher.group()
|
curChapter.title = matcher.group()
|
||||||
curChapter.start = curOffset + chapterLength
|
curChapter.start = curOffset + chapterLength
|
||||||
|
curChapter.end = curChapter.start
|
||||||
toc.add(curChapter)
|
toc.add(curChapter)
|
||||||
lastChapterWordCount = 0
|
lastChapterWordCount = 0
|
||||||
} else if (seekPos == 0 && chapterStart != 0) {
|
} else if (seekPos == 0 && chapterStart != 0) {
|
||||||
@@ -242,6 +243,7 @@ class TextFile(private var book: Book) {
|
|||||||
val curChapter = BookChapter()
|
val curChapter = BookChapter()
|
||||||
curChapter.title = matcher.group()
|
curChapter.title = matcher.group()
|
||||||
curChapter.start = curOffset + chapterLength
|
curChapter.start = curOffset + chapterLength
|
||||||
|
curChapter.end = curChapter.start
|
||||||
toc.add(curChapter)
|
toc.add(curChapter)
|
||||||
} else { //否则就block分割之后,上一个章节的剩余内容
|
} else { //否则就block分割之后,上一个章节的剩余内容
|
||||||
//获取上一章节
|
//获取上一章节
|
||||||
@@ -257,6 +259,7 @@ class TextFile(private var book: Book) {
|
|||||||
val curChapter = BookChapter()
|
val curChapter = BookChapter()
|
||||||
curChapter.title = matcher.group()
|
curChapter.title = matcher.group()
|
||||||
curChapter.start = lastChapter.end
|
curChapter.start = lastChapter.end
|
||||||
|
curChapter.end = curChapter.start
|
||||||
toc.add(curChapter)
|
toc.add(curChapter)
|
||||||
}
|
}
|
||||||
bookWordCount += chapterContent.length
|
bookWordCount += chapterContent.length
|
||||||
@@ -275,6 +278,7 @@ class TextFile(private var book: Book) {
|
|||||||
val curChapter = BookChapter()
|
val curChapter = BookChapter()
|
||||||
curChapter.title = matcher.group()
|
curChapter.title = matcher.group()
|
||||||
curChapter.start = lastChapter.end
|
curChapter.start = lastChapter.end
|
||||||
|
curChapter.end = curChapter.start
|
||||||
toc.add(curChapter)
|
toc.add(curChapter)
|
||||||
} else { //如果章节不存在则创建章节
|
} else { //如果章节不存在则创建章节
|
||||||
val curChapter = BookChapter()
|
val curChapter = BookChapter()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.text.Layout
|
|||||||
import android.text.StaticLayout
|
import android.text.StaticLayout
|
||||||
import android.text.TextPaint
|
import android.text.TextPaint
|
||||||
import androidx.core.os.postDelayed
|
import androidx.core.os.postDelayed
|
||||||
|
import io.legado.app.constant.AppLog
|
||||||
import io.legado.app.constant.AppPattern
|
import io.legado.app.constant.AppPattern
|
||||||
import io.legado.app.constant.EventBus
|
import io.legado.app.constant.EventBus
|
||||||
import io.legado.app.data.entities.Book
|
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.spToPx
|
||||||
import io.legado.app.utils.splitNotBlank
|
import io.legado.app.utils.splitNotBlank
|
||||||
import io.legado.app.utils.textHeight
|
import io.legado.app.utils.textHeight
|
||||||
import io.legado.app.utils.toastOnUi
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import java.util.LinkedList
|
import java.util.LinkedList
|
||||||
@@ -1021,7 +1021,7 @@ object ChapterProvider {
|
|||||||
visibleBottom = paddingTop + visibleHeight
|
visibleBottom = paddingTop + visibleHeight
|
||||||
|
|
||||||
if (paddingLeft >= visibleRight || paddingTop >= visibleBottom) {
|
if (paddingLeft >= visibleRight || paddingTop >= visibleBottom) {
|
||||||
appCtx.toastOnUi("边距设置过大,请重新设置")
|
AppLog.put("边距设置过大,请重新设置", toast = true)
|
||||||
visibleRect.set(
|
visibleRect.set(
|
||||||
0f,
|
0f,
|
||||||
0f,
|
0f,
|
||||||
|
|||||||
Reference in New Issue
Block a user