skydoves / ColorPickerView

🎨 Android colorpicker for getting colors from any images by tapping on the desired color.
Apache License 2.0
1.58k stars 212 forks source link

Make SharedPreferences name configurable #145

Open chrgernoe opened 7 months ago

chrgernoe commented 7 months ago

Is your feature request related to a problem?

In my app I would like to set the SharedPreferences name (XML file) to a specific value for backward compatibility.

In the current implementation of this package the context name is used and cannot be changed. In the Android preference implementation the names can be changed. Since this package is used by your project ColorPickerPreference, which extends the Android classes, it leads to the issue that preferences are stored in different XML files.

Describe the solution you'd like:

My suggestion would be to implement the same behavior as in the Android library. Make the preference manager public and implement a method to set the shared preference name.

Describe alternatives you've considered:

Currently I'm using the Kotlin extension language feature to make the ColorPickerView().preferenceManager and ColorPickerPreferenceManager().sharedPreferences accessible. It works but in my eyes it is no clean solution.