Allow to regenerate shared preferences

I encountered a problem that changing preferences in APG did not change
the preferences in ApgService after it was called once:

1. call getPreferences
2. change settings in APG
3. call getPreferences again

--> the result at 3. was still having preferences from 1.

To work around this, the function getPreferences has been updated to
force the new generation of preferences while not breaking any other
code relying on the old behaviour.
This commit is contained in:
Markus Doits 2010-12-30 13:39:46 +00:00
parent ec988efb55
commit ed0df2803f

View File

@ -12,9 +12,13 @@ public class Preferences {
private static Preferences mPreferences;
private SharedPreferences mSharedPreferences;
public static synchronized Preferences getPreferences(Context context)
public static synchronized Preferences getPreferences(Context context) {
return getPreferences(context, false);
}
public static synchronized Preferences getPreferences(Context context, boolean force_new)
{
if (mPreferences == null) {
if (mPreferences == null || force_new) {
mPreferences = new Preferences(context);
}
return mPreferences;