I am using XML preferences and PreferenceFragmentCompat. I want to encrypt some of the values, such as passwords, but not others, such as theme settings. It seems that what I want to use would be EncryptedSharedPreferences. But I'm not sure how to make it work with the UI. I see two issues:
- There seems to be no way to specify that this or this
Preferenceshould be using this or thisSharedPreferenceinstance; - There seems to be no way of making
PreferenceFragmentCompatuse anything other than a single standardSharedPreferencefile, as set by methods such asPreferenceManager#setSharedPreferencesName.
The questions are,
- What's a way to make this work with minimal changes to the current codebase? And,
- What would be the ideal way to make this work if I'm willing to do a considerable rewrite?