diff options
author | Allan Wang <me@allanwang.ca> | 2019-07-01 15:09:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 15:09:18 -0700 |
commit | 7f260584ebf03757d3b22016b0d04970e0639f90 (patch) | |
tree | 5b2ee3e19842d91c1ee26ebf684e0526e7d6a5e8 /core/README.md | |
parent | 273430e0fb1b884826382349b46a917ce42ebe0b (diff) | |
parent | 6154ad0708be6b09acf8a3ff81b822fbf985e8d9 (diff) | |
download | kau-7f260584ebf03757d3b22016b0d04970e0639f90.tar.gz kau-7f260584ebf03757d3b22016b0d04970e0639f90.tar.bz2 kau-7f260584ebf03757d3b22016b0d04970e0639f90.zip |
Merge pull request #215 from AllanWang/kpref-mockable
Kpref mockable
Diffstat (limited to 'core/README.md')
-rw-r--r-- | core/README.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/README.md b/core/README.md index b9a10f5..b1140bf 100644 --- a/core/README.md +++ b/core/README.md @@ -71,6 +71,14 @@ object MyPrefs : KPref() { Notice that it is a `val` and takes no default. It will return true the first time and false for all subsequent calls. +### KPref Testing + +If your android components can be tested without an emulator, you can also modify KPref to operate without shared preferences. +To do so, call `KPref(KPrefBuilderInMemory)` when creating your preferences. +This variant does not pass updates to the shared preferences. +To set the builder, you may wish to use dependency injection or service locators to supply the builder and the KPref. +In that case, your preferences would be a class instead of an object. + ## Changelog XML Create an xml resource with the following structure: |