mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user