topl-service-base / io.matthewnelson.topl_service_base / TorServicePrefs
TorServicePrefs¶
class TorServicePrefs :
BaseServiceConsts
(source)
This class provides a standardized way for library users to change settings used
by the topl-service
module such that the values expressed as default
io.matthewnelson.topl_service_base.ApplicationDefaultTorSettings when initializing things
can be modified by the implementing application.
The values saved to TorServicePrefs are always preferred over the defaults declared
when initializing the topl-service
module.
Restarting Tor is currently required for the new settings to take effect.
Constructors¶
Name | Summary |
---|---|
<init> | This class provides a standardized way for library users to change settings used by the topl-service module such that the values expressed as default io.matthewnelson.topl_service_base.ApplicationDefaultTorSettings when initializing things can be modified by the implementing application.TorServicePrefs(context: Context ) |
Functions¶
Name | Summary |
---|---|
clear | fun clear(): Unit |
contains | Checks if the SharedPreference contains a value for the supplied prefsKey. Accepts the following annotation type String values:fun contains(prefsKey: String ): Boolean |
getAll | fun getAll(): Map < String , *> |
getBoolean | Returns a Boolean value for the provided BaseServiceConsts.PrefKeyBoolean. If no value is stored in the SharedPreference, defValue will be returned.fun getBoolean(booleanKey: String , defValue: Boolean ): Boolean |
getInt | Returns an Int value for the provided BaseServiceConsts.PrefKeyInt. If no value is stored in the SharedPreference, defValue will be returned.fun getInt(intKey: String , defValue: Int ?): Int ? |
getList | Returns a List of Strings for the provided BaseServiceConsts.PrefKeyList. If no value is stored in the SharedPreference, defValue will be returned.fun getList(listKey: String , defValue: List < String >): List < String > |
getString | Returns a String value for the provided BaseServiceConsts.PrefKeyString. If no value is stored in the SharedPreference, defValue will be returned.fun getString(stringKey: String , defValue: String ?): String ? |
putBoolean | Inserts a Boolean value into the SharedPreference for the supplied booleanKey.fun putBoolean(booleanKey: String , value: Boolean ): Unit |
putInt | Inserts an Int value into the SharedPreference for the supplied intKey.fun putInt(intKey: String , value: Int ?): Unit |
putList | Inserts a List of Strings as a comma separated String into the SharedPreference for the supplied listKey.fun putList(listKey: String , value: List < String >): Unit |
putString | Inserts a String value into the SharedPreference for the supplied stringKey.fun putString(stringKey: String , value: String ?): Unit |
registerListener | Registers a SharedPreferences.OnSharedPreferenceChangeListener for the associated SharedPreferencefun registerListener(listener: OnSharedPreferenceChangeListener ): Unit |
remove | Removes from the SharedPreference the value associated with prefsKey if there is one. Accepts the following annotation type String values:fun remove(prefsKey: String ): Unit |
unregisterListener | Unregisters a SharedPreferences.OnSharedPreferenceChangeListener for the associated SharedPreferencefun unregisterListener(listener: OnSharedPreferenceChangeListener ): Unit |
Companion Object Properties¶
Name | Summary |
---|---|
NULL_INT_VALUE | const val NULL_INT_VALUE: Int |
NULL_STRING_VALUE | const val NULL_STRING_VALUE: String |
TOR_SERVICE_PREFS_NAME | const val TOR_SERVICE_PREFS_NAME: String |