pull/37/head
kunfei 5 years ago
parent 6f2f506bee
commit c8040a4278
  1. 8
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt

@ -20,6 +20,8 @@ import java.io.IOException
*/
object ReadBookConfig {
const val readConfigFileName = "readConfig.json"
private val configFilePath =
App.INSTANCE.filesDir.absolutePath + File.separator + readConfigFileName
val configList: ArrayList<Config> = arrayListOf()
var styleSelect
@ -40,8 +42,7 @@ object ReadBookConfig {
}
fun upConfig() {
val configFile =
File(App.INSTANCE.filesDir.absolutePath + File.separator + readConfigFileName)
val configFile = File(configFilePath)
val json = if (configFile.exists()) {
configFile.readText()
} else {
@ -68,8 +69,7 @@ object ReadBookConfig {
fun save() {
GlobalScope.launch(IO) {
val json = GSON.toJson(configList)
val configFile =
File(App.INSTANCE.filesDir.absolutePath + File.separator + readConfigFileName)
val configFile = File(configFilePath)
//获取流并存储
try {
BufferedWriter(FileWriter(configFile)).use { writer ->

Loading…
Cancel
Save