From 1fcb255170a2be35eecc5645a7b1757101b844f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Mon, 18 Mar 2013 12:00:47 +0100 Subject: Refactored ProviderAPI code. ConfigurationWizard works without problem for both new and preseeded providers. I've added flow control for the activity to finish when all files have been downloaded, managing errors with setResult(RESULT_CANCELED). --- src/se/leap/leapclient/ConfigurationWizard.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/se/leap/leapclient/ConfigurationWizard.java') diff --git a/src/se/leap/leapclient/ConfigurationWizard.java b/src/se/leap/leapclient/ConfigurationWizard.java index 69e13f1..90e74e5 100644 --- a/src/se/leap/leapclient/ConfigurationWizard.java +++ b/src/se/leap/leapclient/ConfigurationWizard.java @@ -126,18 +126,12 @@ public class ConfigurationWizard extends Activity try { saveProviderJson(current_provider_item); downloadJSONFiles(current_provider_item); - } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } - - // FIXME!! We're going to have more Fragments and listeners, flow control? - // TODO There is no testing done to know if we're okay... - setResult(RESULT_OK); - finish(); } } @@ -214,5 +208,13 @@ public class ConfigurationWizard extends Activity .replace(R.id.configuration_wizard_layout, providerList, "providerlist") .commit(); } + else if(resultCode == ConfigHelper.CORRECTLY_DOWNLOADED_JSON_FILES) { + setResult(RESULT_OK); + finish(); + } + else if(resultCode == ConfigHelper.INCORRECTLY_DOWNLOADED_JSON_FILES) { + setResult(RESULT_CANCELED); + finish(); + } } } -- cgit v1.2.3