Hello darkfrog!
There is a problem in PreferencesGameSettings: It's not possible to remove a key. This wouldn't be so bad if we could store a null value with PreferencesGameSettings.set(key, null), but this gives a NPE. Of course there are workarounds for this, but I think removing keys as a very basic operation should be supported.
I see two possible solutions:
- add a remove(String key) method to the GameSettings interface and and PreferencesGameSettings (simply calling preferences.remove(key)). I'd prefer this.
- include a check for null:
public void set(String name, String value) {
if (value == null) {
preferences.remove(key);
} else {
preferences.put(name, value);
}
}