pull/32/head
kunfei 5 years ago
parent ea5648a848
commit 5582df3669
  1. 5
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt

@ -3,7 +3,6 @@ package io.legado.app.help
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import com.google.gson.reflect.TypeToken
import io.legado.app.App import io.legado.app.App
import io.legado.app.utils.GSON import io.legado.app.utils.GSON
import io.legado.app.utils.fromJsonArray import io.legado.app.utils.fromJsonArray
@ -24,7 +23,6 @@ object ReadBookConfig {
String(App.INSTANCE.assets.open("readConfig.json").readBytes()) String(App.INSTANCE.assets.open("readConfig.json").readBytes())
} }
try { try {
// val listType = object : TypeToken<List<Config>>() {}.type
GSON.fromJsonArray<Config>(json)?.let { GSON.fromJsonArray<Config>(json)?.let {
list.addAll(it) list.addAll(it)
} }
@ -70,8 +68,7 @@ object ReadBookConfig {
fun reset() { fun reset() {
try { try {
val json = String(App.INSTANCE.assets.open("readConfig.json").readBytes()) val json = String(App.INSTANCE.assets.open("readConfig.json").readBytes())
val listType = object : TypeToken<List<Config>>() {}.type GSON.fromJsonArray<Config>(json)?.let {
GSON.fromJson<List<Config>>(json, listType)?.let {
configList.clear() configList.clear()
configList.addAll(it) configList.addAll(it)
} }

Loading…
Cancel
Save