feat: 优化代码

pull/133/head
kunfei 5 years ago
parent 1fde270208
commit f78e2383ed
  1. 6
      app/src/main/java/io/legado/app/App.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt

@ -48,12 +48,8 @@ class App : Application() {
versionCode = it.versionCode versionCode = it.versionCode
versionName = it.versionName versionName = it.versionName
} }
if (!ThemeStore.isConfigured(this, versionCode)) applyTheme()
initNightMode()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) createChannelId() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) createChannelId()
applyDayNight()
LiveEventBus.get() LiveEventBus.get()
.config() .config()
.supportBroadcast(this) .supportBroadcast(this)

@ -231,7 +231,7 @@ object ChapterProvider {
textLine.text = "$words\n" textLine.text = "$words\n"
var x = startX var x = startX
for (i in words.indices) { for (i in words.indices) {
val char = words[i].toString() val char = words.substring(i, i + 1)
val cw = StaticLayout.getDesiredWidth(char, textPaint) val cw = StaticLayout.getDesiredWidth(char, textPaint)
val x1 = x + cw val x1 = x + cw
textLine.addTextChar( textLine.addTextChar(

Loading…
Cancel
Save