Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preference Change Listener #3

Open
sugarmanz opened this issue Jan 17, 2018 · 2 comments
Open

Preference Change Listener #3

sugarmanz opened this issue Jan 17, 2018 · 2 comments

Comments

@sugarmanz
Copy link

I love this implementation of a Preference wrapper, but I find myself using Preference change listeners sometimes and would like to know if this is something you've considered adding functionality for.

@MarcinMoskala
Copy link
Owner

This code looks good, but I am not sure why placing it inside PreferenceHolder? It could be placed in any other class as long as the same SheredPreferences are used. Maybe instead I should just add an option to register concrete SheredPreferences instead of passing Context? Then you could initialize both in Application:

val preferences = PreferenceManager.getDefaultSharedPreferences(context)
PreferenceHolder.setPreferences(preferences)
PreferenceListeners.setPreferences(preferences)

This solution would be more general.

@sugarmanz
Copy link
Author

Yeah. That makes a bit more sense. The only reason I would consider including it in this library is it would remove boilerplate code for each app I want to use preference listeners in conjunction with preferenceholder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants