diff options
author | Parménides GV <parmegv@sdf.org> | 2015-03-12 12:54:18 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-03-12 12:54:18 +0100 |
commit | 037d65da739ed2630affe181894e640fa06d35b1 (patch) | |
tree | 72c7127ff5efdb10ba6b2e85be29ea61ff99be2e /app/src | |
parent | c5124635b8272d08538889c1a9edfafe4acaf759 (diff) |
Restore state on Configuration Wizard.
Diffstat (limited to 'app/src')
3 files changed, 18 insertions, 10 deletions
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(); diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index abab106d..f5e78e65 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -96,7 +96,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); } @@ -113,7 +112,6 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download if (savedInstanceState != null) restoreState(savedInstanceState); - else setUpProviderAPIResultReceiver(); } @@ -121,9 +119,13 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download progressbar_text = savedInstanceState.getString(PROGRESSBAR_TEXT, ""); 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 @@ -355,6 +357,7 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download DialogFragment newFragment = ProviderDetailFragment.newInstance(); newFragment.show(fragment_transaction, ProviderDetailFragment.TAG); + setting_up_provider = false; } } |