|
|
@@ -73,6 +73,10 @@ class TextChapterLayout(
|
|
|
private val stringBuilder = StringBuilder()
|
|
|
|
|
|
private val paragraphIndent = ReadBookConfig.paragraphIndent
|
|
|
+ private val titleMode = ReadBookConfig.titleMode
|
|
|
+ private val useZhLayout = ReadBookConfig.useZhLayout
|
|
|
+ private val isMiddleTitle = ReadBookConfig.isMiddleTitle
|
|
|
+ private val textFullJustify = ReadBookConfig.textFullJustify
|
|
|
|
|
|
private var pendingTextPage = TextPage()
|
|
|
|
|
|
@@ -196,7 +200,7 @@ class TextChapterLayout(
|
|
|
val isSingleImageStyle = imageStyle.equals(Book.imgStyleSingle, true)
|
|
|
val isTextImageStyle = imageStyle.equals(Book.imgStyleText, true)
|
|
|
|
|
|
- if (ReadBookConfig.titleMode != 2 || bookChapter.isVolume || contents.isEmpty()) {
|
|
|
+ if (titleMode != 2 || bookChapter.isVolume || contents.isEmpty()) {
|
|
|
//标题非隐藏
|
|
|
displayTitle.splitNotBlank("\n").forEach { text ->
|
|
|
setTypeText(
|
|
|
@@ -406,7 +410,7 @@ class TextChapterLayout(
|
|
|
) {
|
|
|
val widthsArray = allocateFloatArray(text.length)
|
|
|
textPaint.getTextWidthsCompat(text, widthsArray)
|
|
|
- val layout = if (ReadBookConfig.useZhLayout) {
|
|
|
+ val layout = if (useZhLayout) {
|
|
|
val (words, widths) = measureTextSplit(text, widthsArray)
|
|
|
val indentSize = if (isFirstLine) paragraphIndent.length else 0
|
|
|
ZhLayout(text, textPaint, visibleWidth, words, widths, indentSize)
|
|
|
@@ -471,7 +475,7 @@ class TextChapterLayout(
|
|
|
//标题x轴居中
|
|
|
val startX = if (
|
|
|
isTitle &&
|
|
|
- (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle
|
|
|
+ (isMiddleTitle || emptyContent || isVolumeTitle
|
|
|
|| imageStyle?.uppercase() == Book.imgStyleSingle)
|
|
|
) {
|
|
|
(visibleWidth - desiredWidth) / 2
|
|
|
@@ -487,7 +491,7 @@ class TextChapterLayout(
|
|
|
else -> {
|
|
|
if (
|
|
|
isTitle &&
|
|
|
- (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle
|
|
|
+ (isMiddleTitle || emptyContent || isVolumeTitle
|
|
|
|| imageStyle?.uppercase() == Book.imgStyleSingle)
|
|
|
) {
|
|
|
//标题居中
|
|
|
@@ -556,7 +560,7 @@ class TextChapterLayout(
|
|
|
srcList: LinkedList<String>?
|
|
|
) {
|
|
|
var x = 0f
|
|
|
- if (!ReadBookConfig.textFullJustify) {
|
|
|
+ if (!textFullJustify) {
|
|
|
addCharsToLineNatural(
|
|
|
book, absStartX, textLine, words,
|
|
|
x, true, textWidths, srcList
|
|
|
@@ -603,7 +607,7 @@ class TextChapterLayout(
|
|
|
textWidths: List<Float>,
|
|
|
srcList: LinkedList<String>?
|
|
|
) {
|
|
|
- if (!ReadBookConfig.textFullJustify) {
|
|
|
+ if (!textFullJustify) {
|
|
|
addCharsToLineNatural(
|
|
|
book, absStartX, textLine, words,
|
|
|
startX, false, textWidths, srcList
|
|
|
@@ -664,7 +668,7 @@ class TextChapterLayout(
|
|
|
textWidths: List<Float>,
|
|
|
srcList: LinkedList<String>?
|
|
|
) {
|
|
|
- val indentLength = ReadBookConfig.paragraphIndent.length
|
|
|
+ val indentLength = paragraphIndent.length
|
|
|
var x = startX
|
|
|
textLine.startX = absStartX + startX
|
|
|
for (index in words.indices) {
|