JakeWharton / u2020

A sample Android app which showcases advanced usage of Dagger among other open source libraries.
https://www.youtube.com/watch?v=0XHx9jtxIxU
Apache License 2.0
5.68k stars 930 forks source link

Change EnumPreference implementation to match StringPreference #157

Closed dkozel closed 9 years ago

dkozel commented 9 years ago

Would a pull request changing the implementation of EnumPreference to match that of the other typed preferences, such as StringPreference be welcome?

The proposed replacement for the class is in this gist: EnumPreference.java

mattprecious commented 9 years ago

EnumPreferences is written that way so MockGithubService can have generic methods for loading/getting/setting the responses. If we change to using EnumPreference then we'll need to instantiate one for each mock response. For u2020 this is fine since there's only one, but it quickly grows out of control as you add more endpoints (we have over 30 internally).

That's not to say that EnumPreference is a bad idea. We have one as well, but there's no use for it right now in this project.