summaryrefslogtreecommitdiff
path: root/src/se/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/se/leap')
-rw-r--r--src/se/leap/leapclient/Dashboard.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java
index 3e8f35a4..cc215be9 100644
--- a/src/se/leap/leapclient/Dashboard.java
+++ b/src/se/leap/leapclient/Dashboard.java
@@ -36,6 +36,10 @@ public class Dashboard extends Activity {
preferences = getPreferences(MODE_PRIVATE);
+ // FIXME provider data!! get parmegv's work so we can stop (or lessen) faking it
+ if ( !preferences.contains("provider") )
+ fixmePrefsFaker(preferences);
+
// Get our provider
provider = Provider.getInstance(preferences);
@@ -45,6 +49,53 @@ public class Dashboard extends Activity {
providerNameTV.setTextSize(28); // TODO maybe to some calculating, or a marquee?
}
+ // FIXME!! We don't want you around here once we have something /real/ going on
+ private void fixmePrefsFaker(SharedPreferences fakeit) {
+ SharedPreferences.Editor fakes = fakeit.edit();
+
+ AssetManager am = getAssets();
+ BufferedReader prov = null;
+ try {
+ prov = new BufferedReader(new InputStreamReader(am.open("providers/bitmask.net_provider.json")));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ BufferedReader serv = null;
+ try {
+ serv = new BufferedReader(new InputStreamReader(am.open("providers/bitmask.net_eip-service.json")));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ StringBuilder provider = new StringBuilder();
+ StringBuilder eip = new StringBuilder();
+
+ String line;
+ try {
+ while ((line = prov.readLine()) != null){
+ provider.append(line);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ String providerjson = provider.toString();
+ try {
+ while ((line = serv.readLine()) != null){
+ eip.append(line);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ String eipjson = eip.toString();
+
+ fakes.putString("provider", providerjson);
+ fakes.putString("eip", eipjson);
+ fakes.commit();
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.