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 width = size.width
when (imageStyle?.toUpperCase(Locale.ROOT)) {
when (imageStyle?.uppercase(Locale.ROOT)) {
Book.imgStyleFull -> {
width = visibleWidth
height = size.height * visibleWidth / size.width

View File

@ -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

View File

@ -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"