You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.
The keys (e.g. TODOTXTPATH_key) are used for storing and accessing shared preferences. Currently they are located in the strings.xml which contains the strings that are meant to be localized. As changing the keys during localization (for whatever reason) would potentially break the app (if the user changes the phone's locale), the keys shouldn't be mixed together with other strings.
I also noticed that some of the keys are used as hardcoded strings at some occasions throughout the code. When moving them to the new xml this should also be fixed.
There are also some of the shared preferences keys stored in Constants.java (The ones not used in the preference activity) that should probably be moved to the keys.xml as well
The text was updated successfully, but these errors were encountered:
chuckbjones
added a commit
to chuckbjones/todo.txt-touch
that referenced
this issue
Jan 8, 2013
Partially fixestodotxt#278
Move sharedPreferences keys from strings.xml to keys.xml.
Remove keys from Constants.java.
Implement Keys.java to read keys from the xml file.
Use methods in Keys.java instead of hard coding the key strings
or duplicating them in Constants.java.
This is not an ideal solution, as we need a Context to look up the
key values in the resource file. A Context is not always available,
and makes the code ugly.
Will refactor into a better solution before submitting pull request.
Started working on this (see chuckbjones/todo.txt-touch@f0f568e). The only issue with putting the keys in a resource file is that we need a context in order to retrieve them (assuming we don't want to duplicate the strings in, e.g, in Constants.java). Will have to refactor the code a bit to remedy this, probably by subclassing SharedPreferences and creating dedicated methods for getting and setting the various values.
The keys (e.g. TODOTXTPATH_key) are used for storing and accessing shared preferences. Currently they are located in the strings.xml which contains the strings that are meant to be localized. As changing the keys during localization (for whatever reason) would potentially break the app (if the user changes the phone's locale), the keys shouldn't be mixed together with other strings.
I also noticed that some of the keys are used as hardcoded strings at some occasions throughout the code. When moving them to the new xml this should also be fixed.
There are also some of the shared preferences keys stored in Constants.java (The ones not used in the preference activity) that should probably be moved to the keys.xml as well
The text was updated successfully, but these errors were encountered: