diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-01-30 23:23:13 -0700 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-01-30 23:23:13 -0700 |
commit | fea68f17a1a69bc3710e1b1b743e0d0ded95234a (patch) | |
tree | 25e1ade33f2301fa923650ade16d1d3f0a006e25 /src | |
parent | 4bcb53cff01cb13530e1011fb6d5ac105be1ba25 (diff) |
FIXME!! Here there be dragons. Of the "fake data seeded by seedy functions" variety,
And there shady json files...Creates Issue #1593
Diffstat (limited to 'src')
-rw-r--r-- | src/se/leap/leapclient/Dashboard.java | 51 |
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. |