diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-02-07 01:33:03 -0700 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-02-07 01:33:03 -0700 |
commit | 6e0142a335eafe8a9b0e41b0e968038c0aeabd11 (patch) | |
tree | 19ea4e88059cdea391049ae3a9bdc66388bd3d63 | |
parent | 72fd6621a988fcc25d1fa93b977cb7d0a88c96d6 (diff) |
Refactor ProviderListActivity.class into ConfigurationWizard.class,
Moves towards our wizard flow; Addresses #1497 #1500
-rw-r--r-- | AndroidManifest.xml | 8 | ||||
-rw-r--r-- | res/layout/activity_configuration_wizard.xml | 8 | ||||
-rw-r--r-- | res/menu/activity_configuration_wizard.xml | 9 | ||||
-rwxr-xr-x | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/se/leap/leapclient/ConfigHelper.java | 4 | ||||
-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.java | 4 |
7 files changed, 42 insertions, 16 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 48ccbda4..56ca7d44 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -152,13 +152,9 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> - <activity - android:name="se.leap.leapclient.ProviderListActivity" - android:label="@string/app" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - </intent-filter> + android:name="se.leap.leapclient.ConfigurationWizard" + android:label="@string/title_activity_configuration_wizard" > </activity> </application> diff --git a/res/layout/activity_configuration_wizard.xml b/res/layout/activity_configuration_wizard.xml new file mode 100644 index 00000000..264ccf98 --- /dev/null +++ b/res/layout/activity_configuration_wizard.xml @@ -0,0 +1,8 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/configuration_wizard_layout" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".ConfigurationWizard" > + +</RelativeLayout>
\ No newline at end of file diff --git a/res/menu/activity_configuration_wizard.xml b/res/menu/activity_configuration_wizard.xml new file mode 100644 index 00000000..77f358b6 --- /dev/null +++ b/res/menu/activity_configuration_wizard.xml @@ -0,0 +1,9 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + + <item + android:id="@+id/menu_settings" + android:orderInCategory="100" + android:showAsAction="never" + android:title="@string/menu_settings"/> + +</menu>
\ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 09252355..1a453fa9 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -260,5 +260,6 @@ <string name="eip_settings_button_description">Access EIP connection settings</string> <string name="eip_status">Status unknown</string> <string name="eip_type_active">EIP</string> + <string name="title_activity_configuration_wizard">Configure LEAP</string> </resources>
\ No newline at end of file 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
|