From 037d65da739ed2630affe181894e640fa06d35b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 12 Mar 2015 12:54:18 +0100 Subject: Restore state on Configuration Wizard. --- .../java/se/leap/bitmaskclient/ConfigurationWizard.java | 13 +++++++++---- app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'app/src/debug/java/se/leap') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java index 27984147..d28bb690 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -95,7 +95,6 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download outState.putString(PROGRESSBAR_TEXT, progressbar_description.getText().toString()); if(selected_provider != null) outState.putParcelable(Provider.KEY, selected_provider); - outState.putParcelable(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver); super.onSaveInstanceState(outState); } @@ -112,7 +111,6 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download if(savedInstanceState != null) restoreState(savedInstanceState); - else setUpProviderAPIResultReceiver(); } @@ -121,8 +119,14 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download provider_name = savedInstanceState.getString(Provider.NAME, ""); selected_provider = savedInstanceState.getParcelable(Provider.KEY); progress = savedInstanceState.getInt(PROGRESSBAR_NUMBER, -1); - providerAPI_result_receiver = savedInstanceState.getParcelable(ProviderAPI.RECEIVER_KEY); - providerAPI_result_receiver.setReceiver(this); + + if(fragment_manager.findFragmentByTag(ProviderDetailFragment.TAG) == null && setting_up_provider) { + if (selected_provider != null) + onItemSelectedUi(selected_provider); + if (progress > 0) + mProgressBar.setProgress(progress); + } + } @Override @@ -356,6 +360,7 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download DialogFragment newFragment = ProviderDetailFragment.newInstance(); newFragment.show(fragment_transaction, ProviderDetailFragment.TAG); + setting_up_provider = false; } } diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java index 0650f0ad..fa923948 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -675,7 +675,7 @@ public class ProviderAPI extends IntentService { String json_file_content = ""; URL provider_url = null; - int seconds_of_timeout = 1; + int seconds_of_timeout = 2; try { provider_url = new URL(string_url); URLConnection url_connection = provider_url.openConnection(); -- cgit v1.2.3