优化 #5186
This commit is contained in:
@@ -3,6 +3,7 @@ package io.legado.app.help.book
|
|||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import android.os.ParcelFileDescriptor
|
import android.os.ParcelFileDescriptor
|
||||||
import androidx.documentfile.provider.DocumentFile
|
import androidx.documentfile.provider.DocumentFile
|
||||||
|
import com.script.rhino.runScriptWithContext
|
||||||
import io.legado.app.constant.AppLog
|
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
|
||||||
@@ -28,7 +29,6 @@ import io.legado.app.utils.getFile
|
|||||||
import io.legado.app.utils.isContentScheme
|
import io.legado.app.utils.isContentScheme
|
||||||
import io.legado.app.utils.onEachParallel
|
import io.legado.app.utils.onEachParallel
|
||||||
import io.legado.app.utils.postEvent
|
import io.legado.app.utils.postEvent
|
||||||
import com.script.rhino.runScriptWithContext
|
|
||||||
import kotlinx.coroutines.Dispatchers.IO
|
import kotlinx.coroutines.Dispatchers.IO
|
||||||
import kotlinx.coroutines.coroutineScope
|
import kotlinx.coroutines.coroutineScope
|
||||||
import kotlinx.coroutines.ensureActive
|
import kotlinx.coroutines.ensureActive
|
||||||
@@ -404,7 +404,11 @@ object BookHelp {
|
|||||||
bookChapter.getFileName()
|
bookChapter.getFileName()
|
||||||
)
|
)
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
return file.readText()
|
val string = file.readText()
|
||||||
|
if (string.isEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return string
|
||||||
}
|
}
|
||||||
if (book.isLocal) {
|
if (book.isLocal) {
|
||||||
val string = LocalBook.getContent(book, bookChapter)
|
val string = LocalBook.getContent(book, bookChapter)
|
||||||
|
|||||||
@@ -144,6 +144,9 @@ object LocalBook {
|
|||||||
val list = ArrayList(LinkedHashSet(chapters))
|
val list = ArrayList(LinkedHashSet(chapters))
|
||||||
list.forEachIndexed { index, bookChapter ->
|
list.forEachIndexed { index, bookChapter ->
|
||||||
bookChapter.index = index
|
bookChapter.index = index
|
||||||
|
if (bookChapter.title.isEmpty()) {
|
||||||
|
bookChapter.title = "无标题章节"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val replaceRules = ContentProcessor.get(book).getTitleReplaceRules()
|
val replaceRules = ContentProcessor.get(book).getTitleReplaceRules()
|
||||||
book.durChapterTitle = list.getOrElse(book.durChapterIndex) { list.last() }
|
book.durChapterTitle = list.getOrElse(book.durChapterIndex) { list.last() }
|
||||||
@@ -191,6 +194,11 @@ object LocalBook {
|
|||||||
return StringEscapeUtils.unescapeHtml4(content)
|
return StringEscapeUtils.unescapeHtml4(content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (content.isNullOrEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return content
|
return content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -214,9 +214,9 @@ class TextChapterLayout(
|
|||||||
emptyContent = contents.isEmpty(),
|
emptyContent = contents.isEmpty(),
|
||||||
isVolumeTitle = bookChapter.isVolume
|
isVolumeTitle = bookChapter.isVolume
|
||||||
)
|
)
|
||||||
}
|
|
||||||
pendingTextPage.lines.last().isParagraphEnd = true
|
pendingTextPage.lines.last().isParagraphEnd = true
|
||||||
stringBuilder.append("\n")
|
stringBuilder.append("\n")
|
||||||
|
}
|
||||||
durY += titleBottomSpacing
|
durY += titleBottomSpacing
|
||||||
|
|
||||||
// 如果是单图模式且当前页有内容,强制分页
|
// 如果是单图模式且当前页有内容,强制分页
|
||||||
|
|||||||
Reference in New Issue
Block a user