summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-02-05 10:35:36 -0700
committerSean Leonard <meanderingcode@aetherislands.net>2013-02-05 10:35:36 -0700
commit4567c97e526154394874b971a29f66c9ca22e6f2 (patch)
treea7b46fd9f912845cbb6046102cff960fc0f2f18c
parent45b86cd7c8922cfd03a7f056941852273c2d122a (diff)
Move Dashboard view building code into a function so it does not run when we have no config (createed NullPointerExceptions)
-rw-r--r--src/se/leap/leapclient/Dashboard.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java
index 7bb71c1e..a7e84eef 100644
--- a/src/se/leap/leapclient/Dashboard.java
+++ b/src/se/leap/leapclient/Dashboard.java
@@ -36,21 +36,12 @@ public class Dashboard extends Activity {
preferences = getPreferences(MODE_PRIVATE);
- // FIXME We need to StartActivityForResult and move the rest to buildDashboard (called in "else" and onActivityResult)
- if ( !preferences.contains("provider") )
+ // Check if we have preferences, run configuration wizard if not
+ // TODO We should do a better check for config that this!
+ if (!preferences.contains("provider") )
startActivity(new Intent(this, ProviderListActivity.class));
-
- // Get our provider
- provider = Provider.getInstance(preferences);
-
- // Set provider name in textview
- providerNameTV = (TextView) findViewById(R.id.providerName);
- providerNameTV.setText(provider.getName());
- providerNameTV.setTextSize(28); // TODO maybe to some calculating, or a marquee?
-
- // TODO Inflate layout fragments for provider's services
- if ( provider.hasEIP() )
- serviceItemEIP();
+ else
+ buildDashboard();
}
// FIXME!! We don't want you around here once we have something /real/ going on
@@ -99,6 +90,20 @@ public class Dashboard extends Activity {
fakes.putString("eip", eipjson);
fakes.commit();
}
+
+ private void buildDashboard() {
+ // Get our provider
+ provider = Provider.getInstance(preferences);
+
+ // Set provider name in textview
+ providerNameTV = (TextView) findViewById(R.id.providerName);
+ providerNameTV.setText(provider.getName());
+ providerNameTV.setTextSize(28); // TODO maybe to some calculating, or a marquee?
+
+ // TODO Inflate layout fragments for provider's services
+ if ( provider.hasEIP() )
+ serviceItemEIP();
+ }
private void serviceItemEIP() {
// FIXME Provider service (eip/openvpn)