|
|
@ -111,27 +111,26 @@ 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").split("\n") |
|
|
|
val start = contentX.first() == "\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 ) |
|
|
|
if (!text.startsWith("<img src=\"")) { //非图片 |
|
|
|
contentX.forEach { text -> |
|
|
|
val isTitle = index == 0 |
|
|
|
if (!text.startsWith("<img src=\"")) { //非图片 |
|
|
|
val textPaint = if (isTitle) titlePaint else contentPaint |
|
|
|
val isTitle = index == 0 |
|
|
|
if (!(isTitle && ReadBookConfig.titleMode == 2)) { |
|
|
|
val textPaint = if (isTitle) titlePaint else contentPaint |
|
|
|
durY = setTypeText( |
|
|
|
if (!(isTitle && ReadBookConfig.titleMode == 2)) { |
|
|
|
text, durY, textPages, |
|
|
|
durY = setTypeText( |
|
|
|
stringBuilder, isTitle, textPaint |
|
|
|
text, durY, textPages, |
|
|
|
) |
|
|
|
stringBuilder, isTitle, textPaint |
|
|
|
} |
|
|
|
) |
|
|
|
} else { //图片 |
|
|
|
|
|
|
|
durY = setTypeImage( |
|
|
|
|
|
|
|
book, bookChapter, text.substring(10, text.length - 2), |
|
|
|
|
|
|
|
durY, textPages, book.getImageStyle() |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { //图片 |
|
|
|
|
|
|
|
durY = setTypeImage( |
|
|
|
|
|
|
|
book, bookChapter, text.substring(10, text.length-2), |
|
|
|
|
|
|
|
durY, textPages, book.getImageStyle() |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
textPages.last().height = durY + 20.dp |
|
|
|
textPages.last().height = durY + 20.dp |
|
|
|