From 5d5d6ae8aeafbba407b9a4cf5985a1cdc1cf2904 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Thu, 11 Jan 2018 19:41:28 +0100 Subject: rename variables to CamelCase --- .../se/leap/bitmaskclient/ConfigurationWizard.java | 46 +++++++++++----------- .../se/leap/bitmaskclient/NewProviderDialog.java | 22 +++++------ 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'app/src/production/java') diff --git a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java index 3f05b0a2..e8182796 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -40,17 +40,17 @@ public class ConfigurationWizard extends BaseConfigurationWizard { public void showAndSelectProvider(String provider_main_url) { try { - selected_provider = new Provider(new URL((provider_main_url))); - adapter.add(selected_provider); + selectedProvider = new Provider(new URL((provider_main_url))); + adapter.add(selectedProvider); adapter.saveProviders(); - autoSelectProvider(selected_provider); + autoSelectProvider(selectedProvider); } catch (MalformedURLException e) { e.printStackTrace(); } } private void autoSelectProvider(Provider provider) { - selected_provider = provider; + selectedProvider = provider; onItemSelectedUi(); onItemSelectedLogic(); } @@ -61,24 +61,24 @@ public class ConfigurationWizard extends BaseConfigurationWizard { */ public void setUpProvider() { mConfigState.setAction(SETTING_UP_PROVIDER); - Intent provider_API_command = new Intent(this, ProviderAPI.class); + Intent providerApiCommand = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); - parameters.putString(Provider.MAIN_URL, selected_provider.getMainUrl().toString()); - if (selected_provider.hasCertificatePin()){ - parameters.putString(Provider.CA_CERT_FINGERPRINT, selected_provider.certificatePin()); + parameters.putString(Provider.MAIN_URL, selectedProvider.getMainUrl().toString()); + if (selectedProvider.hasCertificatePin()){ + parameters.putString(Provider.CA_CERT_FINGERPRINT, selectedProvider.certificatePin()); } - if (selected_provider.hasCaCert()) { - parameters.putString(Provider.CA_CERT, selected_provider.getCaCert()); + if (selectedProvider.hasCaCert()) { + parameters.putString(Provider.CA_CERT, selectedProvider.getCaCert()); } - if (selected_provider.hasDefinition()) { - parameters.putString(Provider.KEY, selected_provider.getDefinition().toString()); + if (selectedProvider.hasDefinition()) { + parameters.putString(Provider.KEY, selectedProvider.getDefinition().toString()); } - provider_API_command.setAction(ProviderAPI.SET_UP_PROVIDER); - provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); - provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver); + providerApiCommand.setAction(ProviderAPI.SET_UP_PROVIDER); + providerApiCommand.putExtra(ProviderAPI.PARAMETERS, parameters); + providerApiCommand.putExtra(ProviderAPI.RECEIVER_KEY, providerAPIResultReceiver); - startService(provider_API_command); + startService(providerApiCommand); } @Override @@ -88,17 +88,17 @@ public class ConfigurationWizard extends BaseConfigurationWizard { addAndSelectNewProvider(ProviderAPI.lastProviderMainUrl()); } else { showProgressBar(); - adapter.hideAllBut(adapter.indexOf(selected_provider)); + adapter.hideAllBut(adapter.indexOf(selectedProvider)); - Intent provider_API_command = new Intent(this, ProviderAPI.class); - provider_API_command.setAction(ProviderAPI.SET_UP_PROVIDER); - provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver); + Intent providerApiCommand = new Intent(this, ProviderAPI.class); + providerApiCommand.setAction(ProviderAPI.SET_UP_PROVIDER); + providerApiCommand.putExtra(ProviderAPI.RECEIVER_KEY, providerAPIResultReceiver); Bundle parameters = new Bundle(); - parameters.putString(Provider.MAIN_URL, selected_provider.getMainUrl().toString()); - provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); + parameters.putString(Provider.MAIN_URL, selectedProvider.getMainUrl().toString()); + providerApiCommand.putExtra(ProviderAPI.PARAMETERS, parameters); - startService(provider_API_command); + startService(providerApiCommand); } } diff --git a/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java b/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java index fc7c9ede..025d5263 100644 --- a/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java +++ b/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java @@ -41,19 +41,19 @@ public class NewProviderDialog extends DialogFragment { final public static String TAG = "newProviderDialog"; @InjectView(R.id.new_provider_url) - EditText url_input_field; + EditText urlInputField; public interface NewProviderDialogInterface { void showAndSelectProvider(String url_provider); } - NewProviderDialogInterface interface_with_ConfigurationWizard; + NewProviderDialogInterface interfaceWithConfigurationWizard; @Override public void onAttach(Context context) { super.onAttach(context); try { - interface_with_ConfigurationWizard = (NewProviderDialogInterface) context; + interfaceWithConfigurationWizard = (NewProviderDialogInterface) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement NoticeDialogListener"); @@ -69,7 +69,7 @@ public class NewProviderDialog extends DialogFragment { ButterKnife.inject(this, view); Bundle arguments = getArguments(); if (arguments != null) { - url_input_field.setText(arguments.getString(Provider.MAIN_URL, "")); + urlInputField.setText(arguments.getString(Provider.MAIN_URL, "")); } builder.setView(view) @@ -89,7 +89,7 @@ public class NewProviderDialog extends DialogFragment { } private void saveProvider() { - String entered_url = url_input_field.getText().toString().trim(); + String entered_url = urlInputField.getText().toString().trim(); if (!entered_url.startsWith("https://")) { if (entered_url.startsWith("http://")) { entered_url = entered_url.substring("http://".length()); @@ -98,10 +98,10 @@ public class NewProviderDialog extends DialogFragment { } if (validURL(entered_url)) { - interface_with_ConfigurationWizard.showAndSelectProvider(entered_url); + interfaceWithConfigurationWizard.showAndSelectProvider(entered_url); Toast.makeText(getActivity().getApplicationContext(), R.string.valid_url_entered, Toast.LENGTH_LONG).show(); } else { - url_input_field.setText(""); + urlInputField.setText(""); Toast.makeText(getActivity().getApplicationContext(), R.string.not_valid_url_entered, Toast.LENGTH_LONG).show(); } } @@ -109,11 +109,11 @@ public class NewProviderDialog extends DialogFragment { /** * Checks if the entered url is valid or not. * - * @param entered_url + * @param enteredUrl * @return true if it's not empty nor contains only the protocol. */ - boolean validURL(String entered_url) { - //return !entered_url.isEmpty() && entered_url.matches("http[s]?://.+") && !entered_url.replaceFirst("http[s]?://", "").isEmpty(); - return android.util.Patterns.WEB_URL.matcher(entered_url).matches(); + boolean validURL(String enteredUrl) { + //return !enteredUrl.isEmpty() && enteredUrl.matches("http[s]?://.+") && !enteredUrl.replaceFirst("http[s]?://", "").isEmpty(); + return android.util.Patterns.WEB_URL.matcher(enteredUrl).matches(); } } -- cgit v1.2.3