Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
interface IValueStore<V> {
fun getValue(): V
fun putValue(v: V)
fun clear()
class ValueStore(private val prefs: SharedPreferences) implements IValueStore<String> {
companion object {
private const val KEY_VALUE = "prefs.value"
override fun getValue() = prefs.getString(KEY_VALUE, "empty")
override fun putValue(v: String) {
prefs.edit().putString(KEY_VALUE, v).apply()
override fun clear() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment