mirror of
https://github.com/gedoor/legado.git
synced 2025-01-05 10:17:15 +08:00
优化
This commit is contained in:
parent
ae3341e2b6
commit
1ec4ef1ffb
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user