mapzen/prefs-plus

Uses deprecated libraries

Closed this issue · 4 comments

Hello,

The (non-support / non-androidx ) version of Preferences has been deprecated for some time now and according to this talk
https://www.youtube.com/watch?v=PS9jhuHECEQ
It is highly recommended to use androidx.Preference instead.

I was wondering if there are any migrations to the new namespace planned / If not, I will contribute a migration myself.

The prefs-plus library has been really useful in multiple projects for me.

I've tried to just replace the headers - the problem is that the androidx EditTextPreference does not expose a getEditText() function.

Fortunately with version 1.1.1 of androidx.preferences a new interface got added that allows modifications to the underlying EditText of EditTextPreference.
Therefore, I was able to port your prefs-plus module to the new androidx.preference namespace.

For EditFloatPreference and EditIntPreference I have also added an optional min/max value that can be set in the .xml file.
If the user exceeds this min/max value the same error is created as if he types a value that can not be parsed.

You can find my changes here: My fork
It also adds another preference library I found really usefull : colorprefernce
(also ported to androidx.preference)

Thanks for the inspiration by your library, it made my life so much easier when I used it in my first android project.
I do not know why google does not expose these functionalities itself in the android / androidx namespace.

I also modified IntLiestPreference to use a default array that maps entry 0 to the integer value '0', entry 1 to the integer value '1' and so on.
But only in case you did not manually specify an entryValues array.

Also, my fork is now on jitpack . I'l update the readme soon.

When adding more specialized features like described above I'l make sure that the my fork does not behave differently than the original library.