fix: add missing ui SharedPreference
This commit is contained in:
parent
6a8e422a30
commit
ce50627989
2 changed files with 5 additions and 2 deletions
|
@ -16,6 +16,7 @@ import java.io.ObjectOutputStream
|
||||||
object PrefManager {
|
object PrefManager {
|
||||||
|
|
||||||
private var generalPreferences: SharedPreferences? = null
|
private var generalPreferences: SharedPreferences? = null
|
||||||
|
private var uiPreferences: SharedPreferences? = null
|
||||||
private var playerPreferences: SharedPreferences? = null
|
private var playerPreferences: SharedPreferences? = null
|
||||||
private var readerPreferences: SharedPreferences? = null
|
private var readerPreferences: SharedPreferences? = null
|
||||||
private var irrelevantPreferences: SharedPreferences? = null
|
private var irrelevantPreferences: SharedPreferences? = null
|
||||||
|
@ -25,6 +26,8 @@ object PrefManager {
|
||||||
fun init(context: Context) { //must be called in Application class or will crash
|
fun init(context: Context) { //must be called in Application class or will crash
|
||||||
generalPreferences =
|
generalPreferences =
|
||||||
context.getSharedPreferences(Location.General.location, Context.MODE_PRIVATE)
|
context.getSharedPreferences(Location.General.location, Context.MODE_PRIVATE)
|
||||||
|
uiPreferences =
|
||||||
|
context.getSharedPreferences(Location.UI.location, Context.MODE_PRIVATE)
|
||||||
playerPreferences =
|
playerPreferences =
|
||||||
context.getSharedPreferences(Location.Player.location, Context.MODE_PRIVATE)
|
context.getSharedPreferences(Location.Player.location, Context.MODE_PRIVATE)
|
||||||
readerPreferences =
|
readerPreferences =
|
||||||
|
@ -353,7 +356,7 @@ object PrefManager {
|
||||||
private fun getPrefLocation(prefLoc: Location): SharedPreferences {
|
private fun getPrefLocation(prefLoc: Location): SharedPreferences {
|
||||||
return when (prefLoc) {
|
return when (prefLoc) {
|
||||||
Location.General -> generalPreferences
|
Location.General -> generalPreferences
|
||||||
Location.UI -> generalPreferences
|
Location.UI -> uiPreferences
|
||||||
Location.Player -> playerPreferences
|
Location.Player -> playerPreferences
|
||||||
Location.Reader -> readerPreferences
|
Location.Reader -> readerPreferences
|
||||||
Location.NovelReader -> readerPreferences
|
Location.NovelReader -> readerPreferences
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PreferencePackager {
|
||||||
val value = typeValueMap["value"]
|
val value = typeValueMap["value"]
|
||||||
|
|
||||||
innerMap[key] =
|
innerMap[key] =
|
||||||
when (typeName) { //wierdly null sometimes so cast to string
|
when (typeName) { //weirdly null sometimes so cast to string
|
||||||
"kotlin.Int" -> (value as? Double)?.toInt()
|
"kotlin.Int" -> (value as? Double)?.toInt()
|
||||||
"kotlin.String" -> value.toString()
|
"kotlin.String" -> value.toString()
|
||||||
"kotlin.Boolean" -> value as? Boolean
|
"kotlin.Boolean" -> value as? Boolean
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue