|
|
@ -111,9 +111,11 @@ object ChapterProvider { |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (book.getImageStyle() != Book.imgStyleText) { |
|
|
|
} else if (book.getImageStyle() != Book.imgStyleText) { |
|
|
|
content.replace(AppPattern.imgPattern.toRegex(), "\n\$0\n") |
|
|
|
var contentX = content.replace(AppPattern.imgPattern.toRegex(), "\n\$0\n").split("\n") |
|
|
|
.split("\n").forEach { text -> |
|
|
|
val start = contentX.first() == "\n" |
|
|
|
if (text.isNotBlank()) { |
|
|
|
val end = contentX.last() == "\n" |
|
|
|
|
|
|
|
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 |
|
|
@ -132,7 +134,6 @@ 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 -> |
|
|
|