From 258585666b4c84f3a4958b1bf0971d9077b9a345 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 1 May 2022 00:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../read/page/provider/ChapterProvider.kt | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index 5db338534..be8eb28b1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -252,12 +252,7 @@ object ChapterProvider { Pair(0f, width.toFloat()) } textLine.textChars.add( - TextChar( - charData = src, - start = x + start, - end = x + end, - isImage = true - ) + TextChar(charData = src, start = x + start, end = x + end, isImage = true) ) textPages.last().textLines.add(textLine) } @@ -349,10 +344,14 @@ object ChapterProvider { textLine.text = words textLine.isParagraphEnd = true //标题x轴居中 - val startX = - if (isTitle && ReadBookConfig.titleMode == 1 || isTitleWithNoContent || isVolumeTitle) - (visibleWidth - layout.getLineWidth(lineIndex)) / 2 - else 0f + val startX = if (isTitle && ReadBookConfig.titleMode == 1 + || isTitleWithNoContent + || isVolumeTitle + ) { + (visibleWidth - layout.getLineWidth(lineIndex)) / 2 + } else { + 0f + } addCharsToLineLast( book, absStartX, textLine, words.toStringArray(), textPaint, startX, srcList @@ -402,11 +401,7 @@ object ChapterProvider { bodyIndent.toStringArray().forEach { char -> val x1 = x + icw textLine.textChars.add( - TextChar( - charData = char, - start = absStartX + x, - end = absStartX + x1 - ) + TextChar(charData = char, start = absStartX + x, end = absStartX + x1) ) x = x1 }