mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-12 05:58:07 -05:00
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:
parent
ec988efb55
commit
ed0df2803f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user