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 textView.text = spannableStringBuilder
pageLengths.add(textView.getCharNum()) val lastCharNum = textView.getCharNum()
textPages.add( if (lastCharNum == 0) {
TextPage( break
index = pageIndex, } else {
text = spannableStringBuilder.delete( pageLengths.add(lastCharNum)
pageLengths[pageIndex], textPages.add(
spannableStringBuilder.length TextPage(
), index = pageIndex,
title = bookChapter.title, text = spannableStringBuilder.delete(
chapterSize = chapterSize, lastCharNum,
chapterIndex = bookChapter.index spannableStringBuilder.length
),
title = bookChapter.title,
chapterSize = chapterSize,
chapterIndex = bookChapter.index
)
) )
) surplusText = surplusText.substring(lastCharNum)
surplusText = surplusText.substring(pageLengths[pageIndex]) pageIndex++
}
pageIndex++
} }
for (item in textPages) { for (item in textPages) {
item.pageSize = textPages.size item.pageSize = textPages.size

Loading…
Cancel
Save