aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Doits <markus.doits@gmail.com>2010-12-30 13:39:46 +0000
committerMarkus Doits <markus.doits@gmail.com>2010-12-30 13:39:46 +0000
commited0df2803f96ac3f586fc40660b08b893fe407fe (patch)
tree202d7e66b5521ab24f3aa650e39b3205c0e34144
parentec988efb55165978233118691ec95268f7d30667 (diff)
downloadopen-keychain-ed0df2803f96ac3f586fc40660b08b893fe407fe.tar.gz
open-keychain-ed0df2803f96ac3f586fc40660b08b893fe407fe.tar.bz2
open-keychain-ed0df2803f96ac3f586fc40660b08b893fe407fe.zip
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.
-rw-r--r--src/org/thialfihar/android/apg/Preferences.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/thialfihar/android/apg/Preferences.java b/src/org/thialfihar/android/apg/Preferences.java
index d22565804..e704d79f3 100644
--- a/src/org/thialfihar/android/apg/Preferences.java
+++ b/src/org/thialfihar/android/apg/Preferences.java
@@ -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;