优化
This commit is contained in:
@@ -242,7 +242,7 @@ class TextChapterLayout(
|
|||||||
contentPaint,
|
contentPaint,
|
||||||
contentPaintTextHeight,
|
contentPaintTextHeight,
|
||||||
contentPaintFontMetrics,
|
contentPaintFontMetrics,
|
||||||
book.getImageStyle(),
|
imageStyle,
|
||||||
srcList = srcList
|
srcList = srcList
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@@ -250,30 +250,32 @@ class TextChapterLayout(
|
|||||||
isSetTypedImage = false
|
isSetTypedImage = false
|
||||||
prepareNextPageIfNeed()
|
prepareNextPageIfNeed()
|
||||||
}
|
}
|
||||||
val matcher = AppPattern.imgPattern.matcher(content)
|
|
||||||
var start = 0
|
var start = 0
|
||||||
while (matcher.find()) {
|
if (content.contains("<img")) {
|
||||||
coroutineContext.ensureActive()
|
val matcher = AppPattern.imgPattern.matcher(content)
|
||||||
val text = content.substring(start, matcher.start())
|
while (matcher.find()) {
|
||||||
if (text.isNotBlank()) {
|
coroutineContext.ensureActive()
|
||||||
setTypeText(
|
val text = content.substring(start, matcher.start())
|
||||||
|
if (text.isNotBlank()) {
|
||||||
|
setTypeText(
|
||||||
|
book,
|
||||||
|
text,
|
||||||
|
contentPaint,
|
||||||
|
contentPaintTextHeight,
|
||||||
|
contentPaintFontMetrics,
|
||||||
|
imageStyle,
|
||||||
|
isFirstLine = start == 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
setTypeImage(
|
||||||
book,
|
book,
|
||||||
text,
|
matcher.group(1)!!,
|
||||||
contentPaint,
|
|
||||||
contentPaintTextHeight,
|
contentPaintTextHeight,
|
||||||
contentPaintFontMetrics,
|
imageStyle
|
||||||
book.getImageStyle(),
|
|
||||||
isFirstLine = start == 0
|
|
||||||
)
|
)
|
||||||
|
isSetTypedImage = true
|
||||||
|
start = matcher.end()
|
||||||
}
|
}
|
||||||
setTypeImage(
|
|
||||||
book,
|
|
||||||
matcher.group(1)!!,
|
|
||||||
contentPaintTextHeight,
|
|
||||||
book.getImageStyle()
|
|
||||||
)
|
|
||||||
isSetTypedImage = true
|
|
||||||
start = matcher.end()
|
|
||||||
}
|
}
|
||||||
if (start < content.length) {
|
if (start < content.length) {
|
||||||
if (isSingleImageStyle && isSetTypedImage) {
|
if (isSingleImageStyle && isSetTypedImage) {
|
||||||
@@ -288,7 +290,7 @@ class TextChapterLayout(
|
|||||||
contentPaint,
|
contentPaint,
|
||||||
contentPaintTextHeight,
|
contentPaintTextHeight,
|
||||||
contentPaintFontMetrics,
|
contentPaintFontMetrics,
|
||||||
book.getImageStyle(),
|
imageStyle,
|
||||||
isFirstLine = start == 0
|
isFirstLine = start == 0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user