Fix XML parsing Kotlin error
This commit is contained in:
parent
5fa452aa74
commit
e6561e5f84
@ -159,7 +159,7 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
if (parser.eventType != XmlPullParser.START_TAG)
|
if (parser.eventType != XmlPullParser.START_TAG)
|
||||||
continue
|
continue
|
||||||
val key: String = parser.getAttributeValue(null, "name")
|
val key: String = parser.getAttributeValue(null, "name")
|
||||||
val value: String = parser.getAttributeValue(null, "value")
|
fun value() = parser.getAttributeValue(null, "value")!!
|
||||||
when (parser.name) {
|
when (parser.name) {
|
||||||
"string" -> {
|
"string" -> {
|
||||||
parser.require(XmlPullParser.START_TAG, null, "string")
|
parser.require(XmlPullParser.START_TAG, null, "string")
|
||||||
@ -168,25 +168,25 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
}
|
}
|
||||||
"boolean" -> {
|
"boolean" -> {
|
||||||
parser.require(XmlPullParser.START_TAG, null, "boolean")
|
parser.require(XmlPullParser.START_TAG, null, "boolean")
|
||||||
putBoolean(key, value.toBoolean())
|
putBoolean(key, value().toBoolean())
|
||||||
parser.nextTag()
|
parser.nextTag()
|
||||||
parser.require(XmlPullParser.END_TAG, null, "boolean")
|
parser.require(XmlPullParser.END_TAG, null, "boolean")
|
||||||
}
|
}
|
||||||
"int" -> {
|
"int" -> {
|
||||||
parser.require(XmlPullParser.START_TAG, null, "int")
|
parser.require(XmlPullParser.START_TAG, null, "int")
|
||||||
putInt(key, value.toInt())
|
putInt(key, value().toInt())
|
||||||
parser.nextTag()
|
parser.nextTag()
|
||||||
parser.require(XmlPullParser.END_TAG, null, "int")
|
parser.require(XmlPullParser.END_TAG, null, "int")
|
||||||
}
|
}
|
||||||
"long" -> {
|
"long" -> {
|
||||||
parser.require(XmlPullParser.START_TAG, null, "long")
|
parser.require(XmlPullParser.START_TAG, null, "long")
|
||||||
putLong(key, value.toLong())
|
putLong(key, value().toLong())
|
||||||
parser.nextTag()
|
parser.nextTag()
|
||||||
parser.require(XmlPullParser.END_TAG, null, "long")
|
parser.require(XmlPullParser.END_TAG, null, "long")
|
||||||
}
|
}
|
||||||
"float" -> {
|
"float" -> {
|
||||||
parser.require(XmlPullParser.START_TAG, null, "int")
|
parser.require(XmlPullParser.START_TAG, null, "int")
|
||||||
putFloat(key, value.toFloat())
|
putFloat(key, value().toFloat())
|
||||||
parser.nextTag()
|
parser.nextTag()
|
||||||
parser.require(XmlPullParser.END_TAG, null, "int")
|
parser.require(XmlPullParser.END_TAG, null, "int")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user