summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-02-07 01:33:03 -0700
committerSean Leonard <meanderingcode@aetherislands.net>2013-02-07 01:33:03 -0700
commit6e0142a335eafe8a9b0e41b0e968038c0aeabd11 (patch)
tree19ea4e88059cdea391049ae3a9bdc66388bd3d63 /src
parent72fd6621a988fcc25d1fa93b977cb7d0a88c96d6 (diff)
Refactor ProviderListActivity.class into ConfigurationWizard.class,
Moves towards our wizard flow; Addresses #1497 #1500
Diffstat (limited to 'src')
-rw-r--r--src/se/leap/leapclient/ConfigHelper.java4
-rw-r--r--src/se/leap/leapclient/ConfigurationWizard.java (renamed from src/se/leap/leapclient/ProviderListActivity.java)24
-rw-r--r--src/se/leap/leapclient/ProviderListFragment.java4
3 files changed, 22 insertions, 10 deletions
diff --git a/src/se/leap/leapclient/ConfigHelper.java b/src/se/leap/leapclient/ConfigHelper.java
index be848db0..b2baed67 100644
--- a/src/se/leap/leapclient/ConfigHelper.java
+++ b/src/se/leap/leapclient/ConfigHelper.java
@@ -15,7 +15,7 @@ public class ConfigHelper {
static void saveSharedPref(String shared_preferences_key, JSONObject content) {
- SharedPreferences.Editor shared_preferences_editor = ProviderListActivity.shared_preferences
+ SharedPreferences.Editor shared_preferences_editor = ConfigurationWizard.shared_preferences
.edit();
shared_preferences_editor.putString(shared_preferences_key,
content.toString());
@@ -23,7 +23,7 @@ public class ConfigHelper {
System.out.println("Shared preferences updated: key = "
+ shared_preferences_key
+ " Content = "
- + ProviderListActivity.shared_preferences.getString(
+ + ConfigurationWizard.shared_preferences.getString(
shared_preferences_key, "Default"));
}
diff --git a/src/se/leap/leapclient/ProviderListActivity.java b/src/se/leap/leapclient/ConfigurationWizard.java
index 972e2bf0..6a7bd10c 100644
--- a/src/se/leap/leapclient/ProviderListActivity.java
+++ b/src/se/leap/leapclient/ConfigurationWizard.java
@@ -9,11 +9,12 @@ import org.json.JSONException;
import org.json.JSONObject;
import se.leap.leapclient.ProviderListContent.ProviderItem;
+import android.app.Activity;
+import android.app.FragmentManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetManager;
import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
/**
@@ -32,7 +33,7 @@ import android.support.v4.app.FragmentActivity;
* {@link ProviderListFragment.Callbacks} interface
* to listen for item selections.
*/
-public class ProviderListActivity extends FragmentActivity
+public class ConfigurationWizard extends Activity
implements ProviderListFragment.Callbacks {
/**
@@ -46,11 +47,24 @@ public class ProviderListActivity extends FragmentActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_provider_list);
-
- shared_preferences = getPreferences(MODE_PRIVATE);
+
+ setContentView(R.layout.activity_configuration_wizard);
+
+ shared_preferences = getSharedPreferences(ConfigHelper.PREFERENCES_KEY,MODE_PRIVATE);
loadPreseededProviders();
+
+ // Only create our fragments if we're not restoring a saved instance
+ if ( savedInstanceState == null ){
+ // TODO Some welcome screen?
+ // We will need better flow control when we have more Fragments (e.g. user auth)
+ ProviderListFragment providerList = new ProviderListFragment();
+
+ FragmentManager fragmentManager = getFragmentManager();
+ fragmentManager.beginTransaction()
+ .add(R.id.configuration_wizard_layout, providerList, "providerlist")
+ .commit();
+ }
// TODO: If exposing deep links into your app, handle intents here.
}
diff --git a/src/se/leap/leapclient/ProviderListFragment.java b/src/se/leap/leapclient/ProviderListFragment.java
index 717a65c1..d83a7bc1 100644
--- a/src/se/leap/leapclient/ProviderListFragment.java
+++ b/src/se/leap/leapclient/ProviderListFragment.java
@@ -1,14 +1,12 @@
package se.leap.leapclient;
import android.app.Activity;
+import android.app.ListFragment;
import android.os.Bundle;
-import android.support.v4.app.ListFragment;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
-import se.leap.leapclient.ProviderListContent;
-
/**
* A list fragment representing a list of Providers. This fragment
* also supports tablet devices by allowing list items to be given an