feat: 优化代码

pull/133/head
kunfei 5 years ago
parent 454c97aecd
commit 722497f599
  1. 31
      app/src/main/java/io/legado/app/help/storage/Restore.kt

@ -8,6 +8,7 @@ import com.jayway.jsonpath.JsonPath
import com.jayway.jsonpath.Option import com.jayway.jsonpath.Option
import com.jayway.jsonpath.ParseContext import com.jayway.jsonpath.ParseContext
import io.legado.app.App import io.legado.app.App
import io.legado.app.BuildConfig
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.* import io.legado.app.data.entities.*
import io.legado.app.help.LauncherIconHelp import io.legado.app.help.LauncherIconHelp
@ -108,22 +109,24 @@ object Restore {
} }
edit.putInt(PreferKey.versionCode, App.INSTANCE.versionCode) edit.putInt(PreferKey.versionCode, App.INSTANCE.versionCode)
edit.apply() edit.apply()
} ReadBookConfig.apply {
ReadBookConfig.apply { styleSelect = App.INSTANCE.getPrefInt(PreferKey.readStyleSelect)
styleSelect = App.INSTANCE.getPrefInt(PreferKey.readStyleSelect) shareLayout = App.INSTANCE.getPrefBoolean(PreferKey.shareLayout)
shareLayout = App.INSTANCE.getPrefBoolean(PreferKey.shareLayout) pageAnim = App.INSTANCE.getPrefInt(PreferKey.pageAnim)
pageAnim = App.INSTANCE.getPrefInt(PreferKey.pageAnim) hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar)
hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar) hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar)
hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar) bodyIndentCount = App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2)
bodyIndentCount = App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2) }
} ChapterProvider.upStyle()
ChapterProvider.upStyle() ReadBook.loadContent()
ReadBook.loadContent() withContext(Main) {
withContext(Main) { App.INSTANCE.applyDayNight()
App.INSTANCE.applyDayNight() }
if (!BuildConfig.DEBUG)
LauncherIconHelp.changeIcon(App.INSTANCE.getPrefString(PreferKey.launcherIcon))
} }
} }
LauncherIconHelp.changeIcon(App.INSTANCE.getPrefString(PreferKey.launcherIcon))
} }
private inline fun <reified T> fileToListT(path: String, fileName: String): List<T>? { private inline fun <reified T> fileToListT(path: String, fileName: String): List<T>? {

Loading…
Cancel
Save