File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
app/src/main/kotlin/org/ninetripods/mq/study/util/sp Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class SharedPreferencesDelegate<T>(
32
32
is Float -> sp.getFloat(finalKey, defaultValue)
33
33
is Boolean -> sp.getBoolean(finalKey, defaultValue)
34
34
is String -> sp.getString(finalKey, defaultValue)
35
+ is Set <* > -> sp.getStringSet(finalKey, defaultValue as ? Set <String >)
35
36
else -> throw IllegalStateException (" Unsupported type" )
36
37
} as T
37
38
}
@@ -45,6 +46,7 @@ class SharedPreferencesDelegate<T>(
45
46
is Float -> putFloat(finalKey, value)
46
47
is Boolean -> putBoolean(finalKey, value)
47
48
is String -> putString(finalKey, value)
49
+ is Set <* > -> putStringSet(finalKey, value.map { it.toString() }.toHashSet())
48
50
else -> throw IllegalStateException (" Unsupported type" )
49
51
}
50
52
apply ()
You can’t perform that action at this time.
0 commit comments