|
@@ -194,6 +194,7 @@ class TextChapterLayout(
|
|
|
titlePaint,
|
|
titlePaint,
|
|
|
titlePaintTextHeight,
|
|
titlePaintTextHeight,
|
|
|
titlePaintFontMetrics,
|
|
titlePaintFontMetrics,
|
|
|
|
|
+ book.getImageStyle(),
|
|
|
isTitle = true,
|
|
isTitle = true,
|
|
|
emptyContent = contents.isEmpty(),
|
|
emptyContent = contents.isEmpty(),
|
|
|
isVolumeTitle = bookChapter.isVolume
|
|
isVolumeTitle = bookChapter.isVolume
|
|
@@ -231,6 +232,7 @@ class TextChapterLayout(
|
|
|
contentPaint,
|
|
contentPaint,
|
|
|
contentPaintTextHeight,
|
|
contentPaintTextHeight,
|
|
|
contentPaintFontMetrics,
|
|
contentPaintFontMetrics,
|
|
|
|
|
+ book.getImageStyle(),
|
|
|
srcList = srcList
|
|
srcList = srcList
|
|
|
).let {
|
|
).let {
|
|
|
absStartX = it.first
|
|
absStartX = it.first
|
|
@@ -250,7 +252,8 @@ class TextChapterLayout(
|
|
|
text,
|
|
text,
|
|
|
contentPaint,
|
|
contentPaint,
|
|
|
contentPaintTextHeight,
|
|
contentPaintTextHeight,
|
|
|
- contentPaintFontMetrics
|
|
|
|
|
|
|
+ contentPaintFontMetrics,
|
|
|
|
|
+ book.getImageStyle()
|
|
|
).let {
|
|
).let {
|
|
|
absStartX = it.first
|
|
absStartX = it.first
|
|
|
durY = it.second
|
|
durY = it.second
|
|
@@ -278,7 +281,8 @@ class TextChapterLayout(
|
|
|
if (AppConfig.enableReview) text + ChapterProvider.reviewChar else text,
|
|
if (AppConfig.enableReview) text + ChapterProvider.reviewChar else text,
|
|
|
contentPaint,
|
|
contentPaint,
|
|
|
contentPaintTextHeight,
|
|
contentPaintTextHeight,
|
|
|
- contentPaintFontMetrics
|
|
|
|
|
|
|
+ contentPaintFontMetrics,
|
|
|
|
|
+ book.getImageStyle()
|
|
|
).let {
|
|
).let {
|
|
|
absStartX = it.first
|
|
absStartX = it.first
|
|
|
durY = it.second
|
|
durY = it.second
|
|
@@ -443,6 +447,7 @@ class TextChapterLayout(
|
|
|
textPaint: TextPaint,
|
|
textPaint: TextPaint,
|
|
|
textHeight: Float,
|
|
textHeight: Float,
|
|
|
fontMetrics: Paint.FontMetrics,
|
|
fontMetrics: Paint.FontMetrics,
|
|
|
|
|
+ imageStyle: String?,
|
|
|
isTitle: Boolean = false,
|
|
isTitle: Boolean = false,
|
|
|
emptyContent: Boolean = false,
|
|
emptyContent: Boolean = false,
|
|
|
isVolumeTitle: Boolean = false,
|
|
isVolumeTitle: Boolean = false,
|
|
@@ -487,8 +492,31 @@ class TextChapterLayout(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- isTitle && textPages.isEmpty() && pendingTextPage.lines.isEmpty() ->
|
|
|
|
|
- y + titleTopSpacing
|
|
|
|
|
|
|
+ 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
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ else -> y + titleTopSpacing
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
else -> y
|
|
else -> y
|
|
|
}
|
|
}
|
|
@@ -539,7 +567,7 @@ class TextChapterLayout(
|
|
|
//标题x轴居中
|
|
//标题x轴居中
|
|
|
val startX = if (
|
|
val startX = if (
|
|
|
isTitle &&
|
|
isTitle &&
|
|
|
- (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle)
|
|
|
|
|
|
|
+ (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle || imageStyle == "SINGLE")
|
|
|
) {
|
|
) {
|
|
|
(visibleWidth - desiredWidth) / 2
|
|
(visibleWidth - desiredWidth) / 2
|
|
|
} else {
|
|
} else {
|
|
@@ -554,7 +582,7 @@ class TextChapterLayout(
|
|
|
else -> {
|
|
else -> {
|
|
|
if (
|
|
if (
|
|
|
isTitle &&
|
|
isTitle &&
|
|
|
- (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle)
|
|
|
|
|
|
|
+ (ReadBookConfig.isMiddleTitle || emptyContent || isVolumeTitle || imageStyle == "SINGLE")
|
|
|
) {
|
|
) {
|
|
|
//标题居中
|
|
//标题居中
|
|
|
val startX = (visibleWidth - desiredWidth) / 2
|
|
val startX = (visibleWidth - desiredWidth) / 2
|