Harmony
Harmony copied to clipboard
[FEATURE REQUEST] Do not call onSharedPreferenceChanged() for self change
I'm in a situation where I do NOT want to be notified of a preference change that was just made from the same activity or service where the SharedPreferencesChangeListener is registered, but I DO want to be notified of changes made by a different class with a different instance of SharedPreferences.Editor(). One way to do this would be to pass a writer identifier tag with any commit call and then pass this to the SharedPreferencesChangeListener so all listeners know who made the change.
If this is already possible please let me know how! As it is now, I could keep track of which preference keys to ignore for the upcoming calls to onSharedPreferenceChanged() but that seems like a bit of an ugly solution, and I'd have to update this list every time I commit. Another way would be to unregister the listener before a commit and re-register right after. Also not ideal if it leads to missed changes from a different process.
P.S. Thank you for this library! I just spent all day migrating over to it. If this is not the place to ask for features, please let me know!