feat: 优化代码

pull/111/head
kunfei 5 years ago
parent 38400a1e8e
commit 2a983a136c
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt

@ -194,7 +194,9 @@ object ChapterProvider {
//最后一行 //最后一行
textLine.text = "$words\n" textLine.text = "$words\n"
stringBuilder.append("\n") stringBuilder.append("\n")
var x = 0f var x = if (ReadBookConfig.durConfig.titleCenter)
(visibleWidth - layout.getLineMax(lineIndex)) / 2
else 0f
for (i in words.indices) { for (i in words.indices) {
val char = words[i].toString() val char = words[i].toString()
val cw = StaticLayout.getDesiredWidth(char, titlePaint) val cw = StaticLayout.getDesiredWidth(char, titlePaint)

Loading…
Cancel
Save