diff options
-rw-r--r-- | res/layout/activity_configuration_wizard.xml | 11 | ||||
-rwxr-xr-x | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/se/leap/leapclient/ConfigurationWizard.java | 18 | ||||
-rw-r--r-- | src/se/leap/leapclient/NewProviderDialog.java | 32 |
4 files changed, 64 insertions, 0 deletions
diff --git a/res/layout/activity_configuration_wizard.xml b/res/layout/activity_configuration_wizard.xml index 264ccf9..7a0823d 100644 --- a/res/layout/activity_configuration_wizard.xml +++ b/res/layout/activity_configuration_wizard.xml @@ -5,4 +5,15 @@ android:layout_height="match_parent" tools:context=".ConfigurationWizard" > + <Button + android:id="@+id/buttonNewProvider" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:layout_marginBottom="24dp" + android:layout_marginLeft="24dp" + android:onClick="addNewProvider" + android:text="@string/new_provider_button" /> + </RelativeLayout>
\ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 1a453fa..ca73c0d 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -261,5 +261,8 @@ <string name="eip_status">Status unknown</string> <string name="eip_type_active">EIP</string> <string name="title_activity_configuration_wizard">Configure LEAP</string> + <string name="new_provider_button">Add new Provider</string> + <string name="introduce_new_provider">Introduce new provider</string> + <string name="save">Save</string> </resources>
\ No newline at end of file diff --git a/src/se/leap/leapclient/ConfigurationWizard.java b/src/se/leap/leapclient/ConfigurationWizard.java index f759b37..86de817 100644 --- a/src/se/leap/leapclient/ConfigurationWizard.java +++ b/src/se/leap/leapclient/ConfigurationWizard.java @@ -10,11 +10,15 @@ import org.json.JSONObject; import se.leap.leapclient.ProviderListContent.ProviderItem;
import android.app.Activity;
+import android.app.DialogFragment;
+import android.app.Fragment;
import android.app.FragmentManager;
+import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetManager;
import android.os.Bundle;
+import android.view.View;
/**
@@ -41,6 +45,8 @@ public class ConfigurationWizard extends Activity * device.
*/
private boolean mTwoPane;
+
+ private int mStackLevel;
static SharedPreferences shared_preferences;
@@ -152,4 +158,16 @@ public class ConfigurationWizard extends Activity startService(provider_API_command);
}
+
+ public void addNewProvider(View view) {
+ FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction();
+ Fragment previous_new_provider_dialog = getFragmentManager().findFragmentByTag("newProviderDialog");
+ if (previous_new_provider_dialog != null) {
+ fragment_transaction.remove(previous_new_provider_dialog);
+ }
+ fragment_transaction.addToBackStack(null);
+
+ DialogFragment newFragment = NewProviderDialog.newInstance();
+ newFragment.show(fragment_transaction, "newProviderDialog");
+ }
}
diff --git a/src/se/leap/leapclient/NewProviderDialog.java b/src/se/leap/leapclient/NewProviderDialog.java new file mode 100644 index 0000000..fd6d461 --- /dev/null +++ b/src/se/leap/leapclient/NewProviderDialog.java @@ -0,0 +1,32 @@ +package se.leap.leapclient; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.DialogInterface; +import android.os.Bundle; + +public class NewProviderDialog extends DialogFragment { + public Dialog onCreateDialog(Bundle savedInstanceState) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setMessage(R.string.introduce_new_provider) + .setPositiveButton(R.string.save, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + // Save provider + } + }) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + // Create the AlertDialog object and return it + return builder.create(); + } + + public static DialogFragment newInstance() { + NewProviderDialog dialog_fragment = new NewProviderDialog(); + return dialog_fragment; + } + +} |