mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
ChapterProvider.kt减少代码
This commit is contained in:
parent
a74da4f968
commit
1125d60d3a
@ -114,6 +114,10 @@ object ChapterProvider {
|
|||||||
var durY = 0f
|
var durY = 0f
|
||||||
textPages.add(TextPage())
|
textPages.add(TextPage())
|
||||||
contents.forEachIndexed { index, content ->
|
contents.forEachIndexed { index, content ->
|
||||||
|
val isTitle = index == 0
|
||||||
|
val isTitleWithNoContent = isTitle && contents.size == 1
|
||||||
|
val isVolumeTitle = isTitle && bookChapter.isVolume
|
||||||
|
val textPaint = if (isTitle) titlePaint else contentPaint
|
||||||
if (book.getImageStyle() == Book.imgStyleText) {
|
if (book.getImageStyle() == Book.imgStyleText) {
|
||||||
var text = content.replace(srcReplaceChar, "▣")
|
var text = content.replace(srcReplaceChar, "▣")
|
||||||
val srcList = LinkedList<String>()
|
val srcList = LinkedList<String>()
|
||||||
@ -128,10 +132,6 @@ object ChapterProvider {
|
|||||||
}
|
}
|
||||||
matcher.appendTail(sb)
|
matcher.appendTail(sb)
|
||||||
text = sb.toString()
|
text = sb.toString()
|
||||||
val isTitle = index == 0
|
|
||||||
val isTitleWithNoContent = isTitle && contents.size == 1
|
|
||||||
val isVolumeTitle = isTitle && bookChapter.isVolume
|
|
||||||
val textPaint = if (isTitle) titlePaint else contentPaint
|
|
||||||
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
|
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
|
||||||
setTypeText(
|
setTypeText(
|
||||||
absStartX, durY, text, textPages, stringBuilder,
|
absStartX, durY, text, textPages, stringBuilder,
|
||||||
@ -147,10 +147,6 @@ object ChapterProvider {
|
|||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
val text = content.substring(start, matcher.start())
|
val text = content.substring(start, matcher.start())
|
||||||
if (text.isNotBlank()) {
|
if (text.isNotBlank()) {
|
||||||
val isTitle = index == 0
|
|
||||||
val isTitleWithNoContent = isTitle && contents.size == 1
|
|
||||||
val isVolumeTitle = isTitle && bookChapter.isVolume
|
|
||||||
val textPaint = if (isTitle) titlePaint else contentPaint
|
|
||||||
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
|
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
|
||||||
setTypeText(
|
setTypeText(
|
||||||
absStartX, durY, text, textPages, stringBuilder,
|
absStartX, durY, text, textPages, stringBuilder,
|
||||||
@ -170,10 +166,6 @@ object ChapterProvider {
|
|||||||
if (start < content.length) {
|
if (start < content.length) {
|
||||||
val text = content.substring(start, content.length)
|
val text = content.substring(start, content.length)
|
||||||
if (text.isNotBlank()) {
|
if (text.isNotBlank()) {
|
||||||
val isTitle = index == 0
|
|
||||||
val isTitleWithNoContent = isTitle && contents.size == 1
|
|
||||||
val isVolumeTitle = isTitle && bookChapter.isVolume
|
|
||||||
val textPaint = if (isTitle) titlePaint else contentPaint
|
|
||||||
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
|
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
|
||||||
setTypeText(
|
setTypeText(
|
||||||
absStartX, durY, text, textPages, stringBuilder,
|
absStartX, durY, text, textPages, stringBuilder,
|
||||||
|
Loading…
Reference in New Issue
Block a user