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