From 449c3953ce79947554bbfd6ed0386d68aa9f04bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 22 Apr 2015 14:20:09 +0200 Subject: Avoid the check for a null provider. A provider can be asked if it's configured or not, so that we don't find more provider = null issues. I've created a DefaultedURL which links to https://example.net, so that we can initialize an URL. I use composition instead of inheritance, since URL class is final. --- app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app/src/debug/java') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java index aac53a07..6ab08a06 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -97,8 +97,7 @@ public class ConfigurationWizard extends Activity outState.putInt(PROGRESSBAR_NUMBER, mProgressBar.getProgress()); if (progressbar_description != null) outState.putString(PROGRESSBAR_TEXT, progressbar_description.getText().toString()); - if (selected_provider != null) - outState.putParcelable(Provider.KEY, selected_provider); + outState.putParcelable(Provider.KEY, selected_provider); super.onSaveInstanceState(outState); } @@ -125,8 +124,7 @@ public class ConfigurationWizard extends Activity progress = savedInstanceState.getInt(PROGRESSBAR_NUMBER, -1); if (fragment_manager.findFragmentByTag(ProviderDetailFragment.TAG) == null && setting_up_provider) { - if (selected_provider != null) - onItemSelectedUi(); + onItemSelectedUi(); if (progress > 0) mProgressBar.setProgress(progress); } @@ -393,7 +391,7 @@ public class ConfigurationWizard extends Activity public void setUpProvider(boolean danger_on) { Intent provider_API_command = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); - parameters.putString(Provider.MAIN_URL, selected_provider.mainUrl().toString()); + parameters.putString(Provider.MAIN_URL, selected_provider.mainUrl().getUrl().toString()); parameters.putBoolean(ProviderItem.DANGER_ON, danger_on); parameters.putString(Provider.CA_CERT_FINGERPRINT, selected_provider.certificatePin()); -- cgit v1.2.3