From 16b7655cf654172f31696c90dad741bb1756f658 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 4 Sep 2020 13:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BF=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/read/page/provider/ChapterProvider.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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 cac399fcf..f39d6783b 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 @@ -45,7 +45,7 @@ object ChapterProvider { /** * 获取拆分完的章节数据 */ - suspend fun getTextChapter( + fun getTextChapter( book: Book, bookChapter: BookChapter, contents: List, @@ -110,7 +110,7 @@ object ChapterProvider { ) } - private suspend fun setTypeImage( + private fun setTypeImage( book: Book, chapter: BookChapter, src: String, @@ -184,14 +184,12 @@ object ChapterProvider { pageLines: ArrayList, pageLengths: ArrayList, stringBuilder: StringBuilder, - isTitle: Boolean + isTitle: Boolean, ): Float { var durY = if (isTitle) y + titleTopSpacing else y val textPaint = if (isTitle) titlePaint else contentPaint val layout = StaticLayout( - text, textPaint, - visibleWidth, - Layout.Alignment.ALIGN_NORMAL, 0f, 0f, true + text, textPaint, visibleWidth, Layout.Alignment.ALIGN_NORMAL, 0f, 0f, true ) for (lineIndex in 0 until layout.lineCount) { val textLine = TextLine(isTitle = isTitle) @@ -262,7 +260,7 @@ object ChapterProvider { textLine: TextLine, words: Array, textPaint: TextPaint, - desiredWidth: Float + desiredWidth: Float, ) { var x = 0f if (!ReadBookConfig.textFullJustify) { @@ -303,7 +301,7 @@ object ChapterProvider { words: Array, textPaint: TextPaint, desiredWidth: Float, - startX: Float + startX: Float, ) { if (!ReadBookConfig.textFullJustify) { addCharsToLineLast( @@ -340,7 +338,7 @@ object ChapterProvider { textLine: TextLine, words: Array, textPaint: TextPaint, - startX: Float + startX: Float, ) { var x = startX words.forEach {