public static final class EncryptedPreferences.Builder
extends java.lang.Object
EncryptedPreferences instance.| 构造器和说明 |
|---|
Builder(android.content.Context context)
The Builder's constructor
|
| 限定符和类型 | 方法和说明 |
|---|---|
EncryptedPreferences |
build()
Build a new
EncryptedPreferences instance with the specified configuration. |
EncryptedPreferences.Builder |
withEncryptionPassword(java.lang.String encryptionPassword)
Specify the encryption password which should be used when reading and writing values to preferences.
|
EncryptedPreferences.Builder |
withOnSharedPreferenceChangeListener(EncryptedPreferences.OnSharedPreferenceChangeListener listener)
Specify an
EncryptedPreferences.OnSharedPreferenceChangeListener which will be registered immediately once the EncryptedPreference instance is initialized. |
EncryptedPreferences.Builder |
withPreferenceName(java.lang.String preferenceName)
Specify the name of the SharedPreferences instance which should be used to read and write values to.
|
EncryptedPreferences.Builder |
withSaveAsSingleton(boolean singleton)
Specify the
EncryptedPreferences instance to be configured as Singleton. |
public Builder(android.content.Context context)
context - public EncryptedPreferences.Builder withEncryptionPassword(java.lang.String encryptionPassword)
encryptionPassword - - The encryption password which should be used when reading and writing valuespublic EncryptedPreferences.Builder withPreferenceName(java.lang.String preferenceName)
preferenceName - - The name which will be used as SharedPreferences instance.public EncryptedPreferences.Builder withSaveAsSingleton(boolean singleton)
EncryptedPreferences instance to be configured as Singleton.
This allows you to retrieve this configured
EncryptedPreferences instance from wherever you need it inside your application by calling EncryptedPreferences.getSingletonInstance().singleton - - Whether to configure the configured EncryptedPreferences instance to be a singleton or not.EncryptedPreferences#getSingletonInstance()}public EncryptedPreferences.Builder withOnSharedPreferenceChangeListener(EncryptedPreferences.OnSharedPreferenceChangeListener listener)
EncryptedPreferences.OnSharedPreferenceChangeListener which will be registered immediately once the EncryptedPreference instance is initialized.
This method can be called multiple times to register multiple EncryptedPreferences.OnSharedPreferenceChangeListener.listener - - The EncryptedPreferences.OnSharedPreferenceChangeListener which should be registeredpublic EncryptedPreferences build()
EncryptedPreferences instance with the specified configuration.EncryptedPreferences instance with the specified configuration