feat: 优化代码

pull/106/head
kunfei 5 years ago
parent 27d40c5cdf
commit 861f04c56a
  1. 8
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt

@ -139,6 +139,9 @@ object ChapterProvider {
)
}
/**
* 标题
*/
private fun joinTitle(
title: String,
y: Int,
@ -218,6 +221,9 @@ object ChapterProvider {
return durY
}
/**
* 正文
*/
private fun joinBody(
text: String,
y: Int,
@ -255,6 +261,7 @@ object ChapterProvider {
)
var words =
text.substring(layout.getLineStart(lineIndex), layout.getLineEnd(lineIndex))
stringBuilder.append(words)
val desiredWidth = layout.getLineMax(lineIndex)
if (lineIndex == 0 && layout.lineCount > 1) {
//第一行
@ -289,6 +296,7 @@ object ChapterProvider {
}
} else if (lineIndex == layout.lineCount - 1) {
//最后一行
stringBuilder.append("\n")
var x = 0
for (i in words.indices) {
val char = words[i].toString()

Loading…
Cancel
Save