|
|
@ -26,6 +26,7 @@ data class TextPage( |
|
|
|
|
|
|
|
|
|
|
|
val lineSize get() = textLines.size |
|
|
|
val lineSize get() = textLines.size |
|
|
|
val charSize get() = text.length |
|
|
|
val charSize get() = text.length |
|
|
|
|
|
|
|
var isMsgPage: Boolean = false |
|
|
|
|
|
|
|
|
|
|
|
fun getLine(index: Int): TextLine { |
|
|
|
fun getLine(index: Int): TextLine { |
|
|
|
return textLines.getOrElse(index) { |
|
|
|
return textLines.getOrElse(index) { |
|
|
@ -78,7 +79,9 @@ data class TextPage( |
|
|
|
|
|
|
|
|
|
|
|
@Suppress("DEPRECATION") |
|
|
|
@Suppress("DEPRECATION") |
|
|
|
fun format(): TextPage { |
|
|
|
fun format(): TextPage { |
|
|
|
if (textLines.isEmpty() && ChapterProvider.viewWidth > 0) { |
|
|
|
if (textLines.isEmpty()) isMsgPage = true |
|
|
|
|
|
|
|
if (isMsgPage && ChapterProvider.viewWidth > 0) { |
|
|
|
|
|
|
|
textLines.clear() |
|
|
|
val visibleWidth = ChapterProvider.visibleRight - ChapterProvider.paddingLeft |
|
|
|
val visibleWidth = ChapterProvider.visibleRight - ChapterProvider.paddingLeft |
|
|
|
val layout = StaticLayout( |
|
|
|
val layout = StaticLayout( |
|
|
|
text, ChapterProvider.contentPaint, visibleWidth, |
|
|
|
text, ChapterProvider.contentPaint, visibleWidth, |
|
|
|