|
|
@ -55,16 +55,12 @@ object ChapterProvider { |
|
|
|
var durY = 0f |
|
|
|
var durY = 0f |
|
|
|
textPages.add(TextPage()) |
|
|
|
textPages.add(TextPage()) |
|
|
|
for ((index, text) in contents.withIndex()) { |
|
|
|
for ((index, text) in contents.withIndex()) { |
|
|
|
if (index == 0) { |
|
|
|
val isTitle = index == 0 |
|
|
|
if (ReadBookConfig.titleMode != 2) { |
|
|
|
if (isTitle && ReadBookConfig.titleMode == 2) { |
|
|
|
durY = setTypeText( |
|
|
|
continue |
|
|
|
text, durY, textPages, pageLines, pageLengths, stringBuilder, true |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
durY = |
|
|
|
|
|
|
|
setTypeText(text, durY, textPages, pageLines, pageLengths, stringBuilder, false) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
durY = |
|
|
|
|
|
|
|
setTypeText(text, durY, textPages, pageLines, pageLengths, stringBuilder, isTitle) |
|
|
|
} |
|
|
|
} |
|
|
|
textPages.last().height = durY + 20.dp |
|
|
|
textPages.last().height = durY + 20.dp |
|
|
|
textPages.last().text = stringBuilder.toString() |
|
|
|
textPages.last().text = stringBuilder.toString() |
|
|
@ -121,7 +117,7 @@ object ChapterProvider { |
|
|
|
stringBuilder.clear() |
|
|
|
stringBuilder.clear() |
|
|
|
pageLines.add(textPages.last().textLines.size) |
|
|
|
pageLines.add(textPages.last().textLines.size) |
|
|
|
pageLengths.add(textPages.last().text.length) |
|
|
|
pageLengths.add(textPages.last().text.length) |
|
|
|
//新页面 |
|
|
|
//新建页面 |
|
|
|
durY = textPaint.textHeight + lineSpacingExtra |
|
|
|
durY = textPaint.textHeight + lineSpacingExtra |
|
|
|
textPages.add(TextPage()) |
|
|
|
textPages.add(TextPage()) |
|
|
|
textPages.last().textLines.add(textLine) |
|
|
|
textPages.last().textLines.add(textLine) |
|
|
|