diff options
author | Parménides GV <parmegv@sdf.org> | 2013-11-11 18:57:02 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2013-12-10 18:18:16 +0100 |
commit | 6f8a6b145f2e699258963a8a1b8f555fc96f4ead (patch) | |
tree | 42f6aa99de5b36c49c94fb830a26fd5d5340384a /src/se/leap/bitmaskclient/ConfigurationWizard.java | |
parent | 9ff9dc75f267bd6e339c026c4f3e73478210b0b6 (diff) |
Retry button prompts new provider dialog.
The user can change the new provider's data entered before failing.
Diffstat (limited to 'src/se/leap/bitmaskclient/ConfigurationWizard.java')
-rw-r--r-- | src/se/leap/bitmaskclient/ConfigurationWizard.java | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java index 012a444c..44d35370 100644 --- a/src/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java @@ -83,7 +83,6 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD public ProviderAPIResultReceiver providerAPI_result_receiver;
private ProviderAPIBroadcastReceiver_Update providerAPI_broadcast_receiver_update;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -355,6 +354,24 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD }
/**
+ * Open the new provider dialog with data
+ */
+ public void addAndSelectNewProvider(String main_url, boolean danger_on) {
+ FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction();
+ Fragment previous_new_provider_dialog = getFragmentManager().findFragmentByTag(NewProviderDialog.TAG);
+ if (previous_new_provider_dialog != null) {
+ fragment_transaction.remove(previous_new_provider_dialog);
+ }
+
+ DialogFragment newFragment = NewProviderDialog.newInstance();
+ Bundle data = new Bundle();
+ data.putString(Provider.MAIN_URL, main_url);
+ data.putBoolean(ProviderItem.DANGER_ON, danger_on);
+ newFragment.setArguments(data);
+ newFragment.show(fragment_transaction, NewProviderDialog.TAG);
+ }
+
+ /**
* Once selected a provider, this fragment offers the user to log in,
* use it anonymously (if possible)
* or cancel his/her election pressing the back button.
@@ -422,9 +439,18 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD provider_API_command.setAction(ProviderAPI.SET_UP_PROVIDER);
provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters);
provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
-
- startService(provider_API_command);
- }
+ + startService(provider_API_command); + } + + public void retrySetUpProvider() { + removeLastProviderItem(); + addAndSelectNewProvider(ProviderAPI.lastProviderMainUrl(), ProviderAPI.lastDangerOn()); + /* + Intent provider_API_command = new Intent(this, ProviderAPI.class); + startService(provider_API_command); + */ + } public void retrySetUpProvider() { Intent provider_API_command = new Intent(this, ProviderAPI.class); @@ -478,7 +504,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD provider_list_fragment.unhideAll();
}
- public void removeLastProviderItem() {
+ private void removeLastProviderItem() {
provider_list_fragment = (ProviderListFragment) getFragmentManager().findFragmentByTag(ProviderListFragment.TAG);
if(provider_list_fragment != null) {
provider_list_fragment.removeLastItem();
|