summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/Provider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/se/leap/leapclient/Provider.java')
-rw-r--r--src/se/leap/leapclient/Provider.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/se/leap/leapclient/Provider.java b/src/se/leap/leapclient/Provider.java
index b5e81c9d..4235acfd 100644
--- a/src/se/leap/leapclient/Provider.java
+++ b/src/se/leap/leapclient/Provider.java
@@ -11,6 +11,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import android.app.Activity;
import android.content.SharedPreferences;
/**
@@ -49,13 +50,24 @@ final class Provider implements Serializable {
/**
*
*/
- private Provider(SharedPreferences preferences) {
+ private Provider() {}
+
+ protected static Provider getInstance(){
+ if(instance==null){
+ instance = new Provider();
+ }
+ return instance;
+ }
+
+ protected void init(Activity activity) {
// Load our preferences from SharedPreferences
// If there's nothing there, we will end up returning a rather empty object
// to whoever called getInstance() and they can run the First Run Wizard
//preferences = context.getgetPreferences(0); // 0 == MODE_PRIVATE, but we don't extend Android's classes...
+ // Load SharedPreferences
+ preferences = activity.getSharedPreferences(ConfigHelper.PREFERENCES_KEY,0); // We don't get MODE_PRIVATE by importing SharedPreferences; i guess it's in Activity?
// Inflate our provider.json data
try {
definition = new JSONObject( preferences.getString("provider", "") );
@@ -66,13 +78,6 @@ final class Provider implements Serializable {
}
}
- protected static Provider getInstance(SharedPreferences preferences){
- if(instance==null){
- instance = new Provider(preferences);
- }
- return instance;
- }
-
protected String getName(){
// Should we pass the locale in, or query the system here?
String lang = Locale.getDefault().getLanguage();