fix storing SP from AAPS
This commit is contained in:
parent
3175fbef31
commit
bc60363618
1 changed files with 5 additions and 5 deletions
|
@ -21,27 +21,27 @@ fun JSONObject.putBoolean(@StringRes key: Int, sp: SP, resourceHelper: ResourceH
|
||||||
if (sp.contains(key)) put(resourceHelper.gs(key), sp.getBoolean(key, false)) else this
|
if (sp.contains(key)) put(resourceHelper.gs(key), sp.getBoolean(key, false)) else this
|
||||||
|
|
||||||
fun JSONObject.storeInt(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
fun JSONObject.storeInt(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
||||||
if (has(resourceHelper.gs(key))) sp.putInt(key, getInt(resourceHelper.gs(key)))
|
if (has(resourceHelper.gs(key))) sp.putString(key, getInt(resourceHelper.gs(key)).toString())
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun JSONObject.storeLong(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
fun JSONObject.storeLong(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
||||||
if (has(resourceHelper.gs(key))) sp.putLong(key, getLong(resourceHelper.gs(key)))
|
if (has(resourceHelper.gs(key))) sp.putString(key, getLong(resourceHelper.gs(key)).toString())
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun JSONObject.storeDouble(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
fun JSONObject.storeDouble(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
||||||
if (has(resourceHelper.gs(key))) sp.putDouble(key, getDouble(resourceHelper.gs(key)))
|
if (has(resourceHelper.gs(key))) sp.putString(key, getDouble(resourceHelper.gs(key)).toString())
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun JSONObject.storeString(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
fun JSONObject.storeString(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
||||||
if (has(resourceHelper.gs(key))) sp.putString(key, getString(resourceHelper.gs(key)))
|
if (has(resourceHelper.gs(key))) sp.putString(key, getString(resourceHelper.gs(key)).toString())
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun JSONObject.storeBoolean(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
fun JSONObject.storeBoolean(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject {
|
||||||
if (has(resourceHelper.gs(key))) sp.putBoolean(key, getBoolean(resourceHelper.gs(key)))
|
if (has(resourceHelper.gs(key))) sp.putString(key, getBoolean(resourceHelper.gs(key)).toString())
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue