RxSharedPreferences

Preference factory class to provide Preference objects used reactive frameworks

Parameters

sharedPreferences

The preferences that back this factory

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun clear()

Clears the underlying shared preferences

Link copied to clipboard

Creates a Boolean preference for the key with a default of false

Creates a Boolean preference for the key with a default of defaultValue

Link copied to clipboard
inline fun <T : Enum<T>> getEnum(key: String?, defaultValue: T): Preference<T>

Creates a T preference for the key using the enum class type T with a default of defaultValue

fun <T : Enum<T>> getEnum(key: String?, defaultValue: T, clazz: Class<T>): Preference<T>

Creates a T preference for the key using the enum class clazz with a default of defaultValue

Link copied to clipboard

Creates a Float preference for the key with a default of 0F

fun getFloat(key: String?, defaultValue: Float): Preference<Float>

Creates a Float preference for the key with a default of defaultValue

Link copied to clipboard

Creates a Int preference for the key with a default of 0

fun getInteger(key: String?, defaultValue: Int): Preference<Int>

Creates a Int preference for the key with a default of defaultValue

Link copied to clipboard

Creates a Long preference for the key with a default of 0L

fun getLong(key: String?, defaultValue: Long): Preference<Long>

Creates a Long preference for the key with a default of defaultValue

Link copied to clipboard
fun <T> getObject(key: String?, defaultValue: T, converter: Preference.Converter<T>): Preference<T>

Creates a T preference for the key using the converter, and with a default of defaultValue.

Link copied to clipboard
fun <T : Any> getObjectNonNull(key: String?, defaultValue: T, converter: Preference.Converter<T>): Preference<T>
Link copied to clipboard

Creates a String preference for the key with a default of an empty string

fun getString(key: String?, defaultValue: String?): Preference<String?>

Creates a String preference for the key with a default of defaultValue

Link copied to clipboard

Creates a string Set preference for the key with a default of emptySet

fun getStringSet(key: String?, defaultValue: Set<String?>?): Preference<Set<String?>?>

Creates a string Set preference for the key with a default of defaultValue