We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f59ab3 commit b961f32Copy full SHA for b961f32
app/src/main/kotlin/org/ninetripods/mq/study/util/sp/SharedPreferencesDelegate.kt
@@ -32,6 +32,7 @@ class SharedPreferencesDelegate<T>(
32
is Float -> sp.getFloat(finalKey, defaultValue)
33
is Boolean -> sp.getBoolean(finalKey, defaultValue)
34
is String -> sp.getString(finalKey, defaultValue)
35
+ is Set<*> -> sp.getStringSet(finalKey, defaultValue as? Set<String>)
36
else -> throw IllegalStateException("Unsupported type")
37
} as T
38
}
@@ -45,6 +46,7 @@ class SharedPreferencesDelegate<T>(
45
46
is Float -> putFloat(finalKey, value)
47
is Boolean -> putBoolean(finalKey, value)
48
is String -> putString(finalKey, value)
49
+ is Set<*> -> putStringSet(finalKey, value.map { it.toString() }.toHashSet())
50
51
52
apply()
0 commit comments