Horis vor 1 Jahr
Ursprung
Commit
a3ba68b0f1

+ 1 - 1
app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@@ -359,7 +359,7 @@ object ChapterProvider {
             }
             var height = size.height
             var width = size.width
-            when (imageStyle?.toUpperCase(Locale.ROOT)) {
+            when (imageStyle?.uppercase(Locale.ROOT)) {
                 Book.imgStyleFull -> {
                     width = visibleWidth
                     height = size.height * visibleWidth / size.width

+ 4 - 19
app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt

@@ -495,23 +495,8 @@ class TextChapterLayout(
             isTitle && textPages.isEmpty() && pendingTextPage.lines.isEmpty() -> {
                 when (imageStyle?.uppercase(Locale.ROOT)) {
                     Book.imgStyleSingle -> {
-                        val textPage = pendingTextPage
-                        if (textPage.lineSize == 0) {
-                            val ty = (visibleHeight - layout.lineCount * textHeight) / 2
-                            if (ty > titleTopSpacing) ty else titleTopSpacing.toFloat()
-                        } else {
-                            var textLayoutHeight = layout.lineCount * textHeight
-                            val fistLine = textPage.getLine(0)
-                            if (fistLine.lineTop < textLayoutHeight + titleTopSpacing) {
-                                textLayoutHeight = fistLine.lineTop - titleTopSpacing
-                            }
-                            textPage.lines.forEach {
-                                it.lineTop -= textLayoutHeight
-                                it.lineBase -= textLayoutHeight
-                                it.lineBottom -= textLayoutHeight
-                            }
-                            y - textLayoutHeight
-                        }
+                        val ty = (visibleHeight - layout.lineCount * textHeight) / 2
+                        if (ty > titleTopSpacing) ty else titleTopSpacing.toFloat()
                     }
 
                     else -> y + titleTopSpacing
@@ -567,7 +552,7 @@ class TextChapterLayout(
                     //标题x轴居中
                     val startX = if (
                         isTitle &&
-                        (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle || imageStyle == "SINGLE")
+                        (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle || imageStyle == Book.imgStyleSingle)
                     ) {
                         (visibleWidth - desiredWidth) / 2
                     } else {
@@ -582,7 +567,7 @@ class TextChapterLayout(
                 else -> {
                     if (
                         isTitle &&
-                        (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle || imageStyle == "SINGLE")
+                        (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle || imageStyle == Book.imgStyleSingle)
                     ) {
                         //标题居中
                         val startX = (visibleWidth - desiredWidth) / 2

+ 2 - 0
gradle/libs.versions.toml

@@ -43,7 +43,9 @@ desugar = "2.0.4"
 activity = "1.9.1"
 kotlinxSerialization = "1.7.1"
 swiperefreshlayout = "1.1.0"
+#noinspection GradleDependency
 recyclerview = "1.2.0"
+#noinspection GradleDependency
 viewpager2 = "1.0.0"
 webkit = "1.11.0"
 zxingLite = "3.2.0"