From 9e7693c112a7c85cae998ae538643cda9660ff7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 27 Jun 2013 20:29:33 +0200 Subject: Coded new fragment appearance Domain, name and description come from provider.json Next step: code buttons to login or to use anonymously. --- src/se/leap/leapclient/ConfigurationWizard.java | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 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 6bf94ca6..6c016209 100644 --- a/src/se/leap/leapclient/ConfigurationWizard.java +++ b/src/se/leap/leapclient/ConfigurationWizard.java @@ -46,7 +46,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_configuration_wizard); + setContentView(R.layout.configuration_wizard_activity); providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler()); providerAPI_result_receiver.setReceiver(this); @@ -124,7 +124,8 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn Toast.makeText(getApplicationContext(), R.string.success, Toast.LENGTH_LONG).show(); //mConfigState.putExtra(CERTIFICATE_RETRIEVED, true); // If this isn't the last step and finish() is moved... setResult(RESULT_OK); - finish(); + //finish(); + showProviderDetails(getCurrentFocus()); } else if(resultCode == ConfigHelper.INCORRECTLY_DOWNLOADED_CERTIFICATE) { mProgressDialog.dismiss(); Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_certificate_message, Toast.LENGTH_LONG).show(); @@ -268,6 +269,24 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn DialogFragment newFragment = NewProviderDialog.newInstance(); newFragment.show(fragment_transaction, ConfigHelper.NEW_PROVIDER_DIALOG); } + + /** + * 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. + * @param view + */ + public void showProviderDetails(View view) { + FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction(); + Fragment previous_provider_details_dialog = getFragmentManager().findFragmentByTag(ConfigHelper.PROVIDER_DETAILS_DIALOG); + if (previous_provider_details_dialog != null) { + fragment_transaction.remove(previous_provider_details_dialog); + } + fragment_transaction.addToBackStack(null); + + DialogFragment newFragment = ProviderDetailFragment.newInstance(); + newFragment.show(fragment_transaction, ConfigHelper.PROVIDER_DETAILS_DIALOG); + } @Override public void saveAndSelectProvider(String provider_main_url, boolean danger_on) { -- cgit v1.2.3 From 36b3b30960bb7c07d3ca4c3a748334627ecb8003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 27 Jun 2013 21:23:49 +0200 Subject: Use anonymously from ProviderDetail works OK. Tested with dev.bitmask.net, I use the previously downloaded certificate (I should not do that, I'll file an issue because I should download it once the user has requested to do so). Next step: login button from ProviderDetailFragment. --- src/se/leap/leapclient/ConfigurationWizard.java | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 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 6c016209..7f29a408 100644 --- a/src/se/leap/leapclient/ConfigurationWizard.java +++ b/src/se/leap/leapclient/ConfigurationWizard.java @@ -31,7 +31,7 @@ import android.widget.Toast; * */ public class ConfigurationWizard extends Activity -implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogInterface, Receiver { +implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogInterface, ProviderDetailFragment.ProviderDetailFragmentInterface, Receiver { private ProviderItem mSelectedProvider; private ProgressDialog mProgressDialog; @@ -85,8 +85,16 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn if(mProgressDialog == null) mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.config_wait_title), getResources().getString(R.string.config_connecting_provider), true); mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_services)); - if(mSelectedProvider == null) + if(mSelectedProvider == null) { mSelectedProvider = getProvider(resultData.getString(ConfigHelper.PROVIDER_ID)); + + ProviderListFragment providerList = new ProviderListFragment(); + + FragmentManager fragmentManager = getFragmentManager(); + fragmentManager.beginTransaction() + .replace(R.id.configuration_wizard_layout, providerList, "providerlist") + .commit(); + } downloadJSONFiles(mSelectedProvider); } catch (JSONException e) { // TODO Auto-generated catch block @@ -321,4 +329,15 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn startService(provider_API_command); } + + @Override + public void login() { + //TODO Start dashboard and show login dialog + } + + @Override + public void use_anonymously() { + setResult(RESULT_OK); + finish(); + } } -- cgit v1.2.3 From 73a18a778abdfd8010c8b7609c99b825cc1554d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 27 Jun 2013 21:52:54 +0200 Subject: Login button from ProviderDetailFragment works. I return an intent with ConfigHelper.LOG_IN extra present. Dashboard looks for it, and if found, starts LogInDialog. --- src/se/leap/leapclient/ConfigurationWizard.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (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 7f29a408..7cf989a4 100644 --- a/src/se/leap/leapclient/ConfigurationWizard.java +++ b/src/se/leap/leapclient/ConfigurationWizard.java @@ -332,7 +332,10 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn @Override public void login() { - //TODO Start dashboard and show login dialog + Intent ask_login = new Intent(); + ask_login.putExtra(ConfigHelper.LOG_IN, ConfigHelper.LOG_IN); + setResult(RESULT_OK, ask_login); + finish(); } @Override -- cgit v1.2.3 From 74f95b56051c5c313febdc59f14e0e9077935817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 27 Jun 2013 21:56:37 +0200 Subject: Removed unnecessary toasts. They are commented, just in case we decide to include any of them before releasing 0.2.0. --- src/se/leap/leapclient/ConfigurationWizard.java | 6 +++--- 1 file changed, 3 insertions(+), 3 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 7cf989a4..df7da8ff 100644 --- a/src/se/leap/leapclient/ConfigurationWizard.java +++ b/src/se/leap/leapclient/ConfigurationWizard.java @@ -117,7 +117,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn downloadAnonCert(); } else { mProgressDialog.dismiss(); - Toast.makeText(getApplicationContext(), R.string.success, Toast.LENGTH_LONG).show(); + //Toast.makeText(getApplicationContext(), R.string.success, Toast.LENGTH_LONG).show(); setResult(RESULT_OK); finish(); } @@ -128,8 +128,8 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn } else if(resultCode == ConfigHelper.CORRECTLY_DOWNLOADED_CERTIFICATE) { mProgressDialog.dismiss(); - Toast.makeText(getApplicationContext(), R.string.correctly_downloaded_json_files_message, Toast.LENGTH_LONG).show(); - Toast.makeText(getApplicationContext(), R.string.success, Toast.LENGTH_LONG).show(); + //Toast.makeText(getApplicationContext(), R.string.correctly_downloaded_json_files_message, Toast.LENGTH_LONG).show(); + //Toast.makeText(getApplicationContext(), R.string.success, Toast.LENGTH_LONG).show(); //mConfigState.putExtra(CERTIFICATE_RETRIEVED, true); // If this isn't the last step and finish() is moved... setResult(RESULT_OK); //finish(); -- cgit v1.2.3