In app build.gradle
:
dependencies {
implementation 'com.nikolaymanzhos:preferenceshelper:2.4'
}
Setup library in Application
class:
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
PreferencesHelper.builder(this)
.build();
}
}
Ability to store List<String>
.
Just call PreferencesHelper#putStringList
and you are good to go!
After PreferencesHelper
has been initialized you can access preferences from any place.
Just call PreferencesHelper.getInstance()
.
To keep all preferences in single place create new class and extend it form DefaultPreferencesManager
class.
Inside your new class you'll have access to preferences by calling getPreferencesHelper()
method.
Set custom properties for your preference storage.
PreferencesHelper.builder(this)
.setMode(ContextWrapper.MODE_PRIVATE)
.setName("MyPrefs")
.build();