diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-02-07 01:36:14 -0700 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-02-07 01:36:14 -0700 |
commit | baaf0fec8894513768f0ba3406a9dfe2d7ad2775 (patch) | |
tree | 209661aeadc99f8df33a09c14ee467b878c0ab89 /src | |
parent | c107e15a1ca7707a7c2351a3c31f3dbd9f156b73 (diff) |
Change in Dashboard to startActivityForResult() ConfigurationWizard
Diffstat (limited to 'src')
-rw-r--r-- | src/se/leap/leapclient/ConfigurationWizard.java | 6 | ||||
-rw-r--r-- | src/se/leap/leapclient/Dashboard.java | 20 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/se/leap/leapclient/ConfigurationWizard.java b/src/se/leap/leapclient/ConfigurationWizard.java index 6a7bd10c..f759b37e 100644 --- a/src/se/leap/leapclient/ConfigurationWizard.java +++ b/src/se/leap/leapclient/ConfigurationWizard.java @@ -118,8 +118,10 @@ public class ConfigurationWizard extends Activity }
}
- Intent dashboardIntent = new Intent(this, Dashboard.class);
- startActivity(dashboardIntent);
+ // FIXME!! We're going to have more Fragments and listeners, flow control?
+ // TODO There is no testing done to know if we're okay...
+ setResult(RESULT_OK);
+ finish();
}
}
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java index b6110aac..dce99b1e 100644 --- a/src/se/leap/leapclient/Dashboard.java +++ b/src/se/leap/leapclient/Dashboard.java @@ -18,6 +18,8 @@ import android.widget.TextView; public class Dashboard extends Activity { + protected static final int CONFIGURE_LEAP = 0; + private static SharedPreferences preferences; private static Provider provider; @@ -34,11 +36,25 @@ public class Dashboard extends Activity { // 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)); + startActivityForResult(new Intent(this,ConfigurationWizard.class),CONFIGURE_LEAP); else buildDashboard(); } - + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data){ + if ( requestCode == CONFIGURE_LEAP ) { + if ( resultCode == RESULT_OK ){ + // Configuration done, get our preferences again + preferences = getSharedPreferences(ConfigHelper.PREFERENCES_KEY,MODE_PRIVATE); + + buildDashboard(); + } else { + // Something went wrong... TODO figure out what + // TODO Error dialog + } + } + } private void buildDashboard() { // Get our provider |