pull/32/head
kunfei 5 years ago
parent 70f1082bba
commit fae1bb05f5
  1. 34
      app/src/main/java/io/legado/app/ui/widget/page/ChapterProvider.kt

@ -35,22 +35,26 @@ object ChapterProvider {
}
}
textView.text = spannableStringBuilder
pageLengths.add(textView.getCharNum())
textPages.add(
TextPage(
index = pageIndex,
text = spannableStringBuilder.delete(
pageLengths[pageIndex],
spannableStringBuilder.length
),
title = bookChapter.title,
chapterSize = chapterSize,
chapterIndex = bookChapter.index
val lastCharNum = textView.getCharNum()
if (lastCharNum == 0) {
break
} else {
pageLengths.add(lastCharNum)
textPages.add(
TextPage(
index = pageIndex,
text = spannableStringBuilder.delete(
lastCharNum,
spannableStringBuilder.length
),
title = bookChapter.title,
chapterSize = chapterSize,
chapterIndex = bookChapter.index
)
)
)
surplusText = surplusText.substring(pageLengths[pageIndex])
pageIndex++
surplusText = surplusText.substring(lastCharNum)
pageIndex++
}
}
for (item in textPages) {
item.pageSize = textPages.size

Loading…
Cancel
Save