Update ChapterProvider.kt

回退
pull/1123/head
bushixuanqi 3 years ago committed by GitHub
parent eec9558a18
commit 23f449e2ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@ -111,11 +111,9 @@ object ChapterProvider {
) )
} }
} else if (book.getImageStyle() != Book.imgStyleText) { } else if (book.getImageStyle() != Book.imgStyleText) {
var contentX = content.replace(AppPattern.imgPattern.toRegex(), "\n\$0\n").split("\n") content.replace(AppPattern.imgPattern.toRegex(), "\n\$0\n")
val start = contentX.first() == "\n" .split("\n").forEach { text ->
val end = contentX.last() == "\n" if (text.isNotBlank()) {
if(start || end )contentX = contentX.subList(if(start) 1 else 0,if(end) contentX.size-1 else contentX.size )
contentX.forEach { text ->
if (!text.startsWith("<img src=\"")) { //非图片 if (!text.startsWith("<img src=\"")) { //非图片
val isTitle = index == 0 val isTitle = index == 0
val textPaint = if (isTitle) titlePaint else contentPaint val textPaint = if (isTitle) titlePaint else contentPaint
@ -134,6 +132,7 @@ object ChapterProvider {
} }
} }
} }
}
textPages.last().height = durY + 20.dp textPages.last().height = durY + 20.dp
textPages.last().text = stringBuilder.toString() textPages.last().text = stringBuilder.toString()
textPages.forEachIndexed { index, item -> textPages.forEachIndexed { index, item ->

Loading…
Cancel
Save