pull/433/head
gedoor 4 years ago
parent 72b7864600
commit 17121a4604
  1. 16
      app/src/main/java/io/legado/app/data/entities/BookChapter.kt

@ -36,19 +36,15 @@ data class BookChapter(
var variable: String? = null //变量
) : Parcelable {
@Ignore
@delegate:Transient
@delegate:Ignore
@IgnoredOnParcel
var variableMap: HashMap<String, String>? = null
private set
get() {
if (field == null) {
field = GSON.fromJsonObject<HashMap<String, String>>(variable) ?: HashMap()
}
return field
}
val variableMap by lazy {
GSON.fromJsonObject<HashMap<String, String>>(variable) ?: HashMap()
}
fun putVariable(key: String, value: String) {
variableMap?.put(key, value)
variableMap[key] = value
variable = GSON.toJson(variableMap)
}

Loading…
Cancel
Save