This commit is contained in:
Horis 2024-12-31 19:58:16 +08:00
parent ae3341e2b6
commit 1ec4ef1ffb
3 changed files with 7 additions and 20 deletions

View File

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

View File

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

View File

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