From b065fa48e802487198ad73915dd017c4464e8c62 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Fri, 19 Jan 2018 17:34:45 +0100 Subject: improve layout * improve layout * gracefully handle orientation changes * respect small devices * set correct colors for buttons, error messages... --- .../se/leap/bitmaskclient/ConfigurationWizard.java | 34 +- .../insecure/res/layout/new_provider_dialog.xml | 2 +- .../AbstractProviderDetailActivity.java | 9 +- .../bitmaskclient/BaseConfigurationWizard.java | 64 ++-- .../bitmaskclient/ConfigWizardBaseActivity.java | 27 +- .../java/se/leap/bitmaskclient/LoginActivity.java | 2 +- .../main/java/se/leap/bitmaskclient/Provider.java | 10 +- .../ProviderCredentialsBaseActivity.java | 344 ++++++++++++++++++--- .../java/se/leap/bitmaskclient/SignupActivity.java | 36 +-- .../main/res/layout-xlarge/a_provider_detail.xml | 32 ++ .../res/layout-xlarge/provider_detail_fragment.xml | 32 -- app/src/main/res/layout/a_login.xml | 38 --- app/src/main/res/layout/a_provider_credentials.xml | 54 ++++ app/src/main/res/layout/a_provider_detail.xml | 40 +++ app/src/main/res/layout/a_signup.xml | 38 --- app/src/main/res/layout/provider_credentials.xml | 66 ++++ .../main/res/layout/provider_credentials_login.xml | 38 --- .../res/layout/provider_credentials_signup.xml | 24 -- .../main/res/layout/provider_detail_fragment.xml | 41 --- app/src/main/res/values-v21/styles.xml | 2 +- app/src/main/res/values-v21/themes.xml | 2 +- .../se/leap/bitmaskclient/ConfigurationWizard.java | 27 +- 22 files changed, 598 insertions(+), 364 deletions(-) create mode 100644 app/src/main/res/layout-xlarge/a_provider_detail.xml delete mode 100644 app/src/main/res/layout-xlarge/provider_detail_fragment.xml delete mode 100644 app/src/main/res/layout/a_login.xml create mode 100644 app/src/main/res/layout/a_provider_credentials.xml create mode 100644 app/src/main/res/layout/a_provider_detail.xml delete mode 100644 app/src/main/res/layout/a_signup.xml create mode 100644 app/src/main/res/layout/provider_credentials.xml delete mode 100644 app/src/main/res/layout/provider_credentials_login.xml delete mode 100644 app/src/main/res/layout/provider_credentials_signup.xml delete mode 100644 app/src/main/res/layout/provider_detail_fragment.xml (limited to 'app/src') diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java index 8a5a6190..3e176fc1 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -64,10 +64,10 @@ public class ConfigurationWizard extends BaseConfigurationWizard { public void showAndSelectProvider(String provider_main_url, boolean danger_on) { try { - selectedProvider = new Provider(new URL((provider_main_url))); - adapter.add(selectedProvider); + provider = new Provider(new URL((provider_main_url))); + adapter.add(provider); adapter.saveProviders(); - autoSelectProvider(selectedProvider, danger_on); + autoSelectProvider(provider, danger_on); } catch (MalformedURLException e) { e.printStackTrace(); } @@ -75,7 +75,7 @@ public class ConfigurationWizard extends BaseConfigurationWizard { private void autoSelectProvider(Provider provider, boolean danger_on) { preferences.edit().putBoolean(ProviderItem.DANGER_ON, danger_on).apply(); - selectedProvider = provider; + provider = provider; onItemSelectedLogic(); showProgressBar(); } @@ -87,24 +87,24 @@ public class ConfigurationWizard extends BaseConfigurationWizard { */ public void setUpProvider(boolean danger_on) { 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, selectedProvider.getMainUrl().toString()); + parameters.putString(Provider.MAIN_URL, provider.getMainUrl().toString()); parameters.putBoolean(ProviderItem.DANGER_ON, danger_on); - if (selectedProvider.hasCertificatePin()){ - parameters.putString(Provider.CA_CERT_FINGERPRINT, selectedProvider.certificatePin()); + if (provider.hasCertificatePin()){ + parameters.putString(Provider.CA_CERT_FINGERPRINT, provider.certificatePin()); } - if (selectedProvider.hasCaCert()) { - parameters.putString(Provider.CA_CERT, selectedProvider.getCaCert()); + if (provider.hasCaCert()) { + parameters.putString(Provider.CA_CERT, provider.getCaCert()); } - if (selectedProvider.hasDefinition()) { - parameters.putString(Provider.KEY, selectedProvider.getDefinition().toString()); + if (provider.hasDefinition()) { + parameters.putString(Provider.KEY, provider.getDefinition().toString()); } - provider_API_command.setAction(ProviderAPI.SET_UP_PROVIDER); - provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); + providerAPICommand.setAction(ProviderAPI.SET_UP_PROVIDER); + providerAPICommand.putExtra(ProviderAPI.PARAMETERS, parameters); - startService(provider_API_command); + startService(providerAPICommand); } /** @@ -117,13 +117,13 @@ public class ConfigurationWizard extends BaseConfigurationWizard { addAndSelectNewProvider(ProviderAPI.lastProviderMainUrl(), ProviderAPI.lastDangerOn()); } else { showProgressBar(); - adapter.hideAllBut(adapter.indexOf(selectedProvider)); + adapter.hideAllBut(adapter.indexOf(provider)); Intent providerAPICommand = new Intent(this, ProviderAPI.class); providerAPICommand.setAction(ProviderAPI.SET_UP_PROVIDER); Bundle parameters = new Bundle(); - parameters.putString(Provider.MAIN_URL, selectedProvider.getMainUrl().toString()); + parameters.putString(Provider.MAIN_URL, provider.getMainUrl().toString()); providerAPICommand.putExtra(ProviderAPI.PARAMETERS, parameters); startService(providerAPICommand); diff --git a/app/src/insecure/res/layout/new_provider_dialog.xml b/app/src/insecure/res/layout/new_provider_dialog.xml index 19b8f442..8888a1d9 100644 --- a/app/src/insecure/res/layout/new_provider_dialog.xml +++ b/app/src/insecure/res/layout/new_provider_dialog.xml @@ -3,7 +3,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > - + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/provider_detail_fragment.xml b/app/src/main/res/layout-xlarge/provider_detail_fragment.xml deleted file mode 100644 index 31538f9f..00000000 --- a/app/src/main/res/layout-xlarge/provider_detail_fragment.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/a_login.xml b/app/src/main/res/layout/a_login.xml deleted file mode 100644 index 5b33ec16..00000000 --- a/app/src/main/res/layout/a_login.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/a_provider_credentials.xml b/app/src/main/res/layout/a_provider_credentials.xml new file mode 100644 index 00000000..85d9d3cb --- /dev/null +++ b/app/src/main/res/layout/a_provider_credentials.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/a_provider_detail.xml b/app/src/main/res/layout/a_provider_detail.xml new file mode 100644 index 00000000..5f07b87c --- /dev/null +++ b/app/src/main/res/layout/a_provider_detail.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/a_signup.xml b/app/src/main/res/layout/a_signup.xml deleted file mode 100644 index b0c8dc47..00000000 --- a/app/src/main/res/layout/a_signup.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/provider_credentials.xml b/app/src/main/res/layout/provider_credentials.xml new file mode 100644 index 00000000..6e4dff95 --- /dev/null +++ b/app/src/main/res/layout/provider_credentials.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/provider_credentials_login.xml b/app/src/main/res/layout/provider_credentials_login.xml deleted file mode 100644 index 915ac231..00000000 --- a/app/src/main/res/layout/provider_credentials_login.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/provider_credentials_signup.xml b/app/src/main/res/layout/provider_credentials_signup.xml deleted file mode 100644 index c2e3dcd3..00000000 --- a/app/src/main/res/layout/provider_credentials_signup.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/provider_detail_fragment.xml b/app/src/main/res/layout/provider_detail_fragment.xml deleted file mode 100644 index e4ee1cca..00000000 --- a/app/src/main/res/layout/provider_detail_fragment.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index b42c7554..b928a79b 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -28,7 +28,7 @@ diff --git a/app/src/main/res/values-v21/themes.xml b/app/src/main/res/values-v21/themes.xml index ac62b94c..d6145217 100644 --- a/app/src/main/res/values-v21/themes.xml +++ b/app/src/main/res/values-v21/themes.xml @@ -11,7 +11,7 @@ @style/BitmaskButton - @color/colorPrimaryDark + @color/colorPrimary @color/colorPrimaryDark diff --git a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java index b1deae67..f7102508 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -40,18 +40,17 @@ public class ConfigurationWizard extends BaseConfigurationWizard { public void showAndSelectProvider(String provider_main_url) { try { - selectedProvider = new Provider(new URL((provider_main_url))); - adapter.add(selectedProvider); + provider = new Provider(new URL((provider_main_url))); + adapter.add(provider); adapter.saveProviders(); - autoSelectProvider(selectedProvider); + autoSelectProvider(provider); } catch (MalformedURLException e) { e.printStackTrace(); } } private void autoSelectProvider(Provider provider) { - selectedProvider = provider; - onItemSelectedUi(); + this.provider = provider; onItemSelectedLogic(); } @@ -63,15 +62,15 @@ public class ConfigurationWizard extends BaseConfigurationWizard { mConfigState.setAction(SETTING_UP_PROVIDER); Intent providerApiCommand = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); - parameters.putString(Provider.MAIN_URL, selectedProvider.getMainUrl().toString()); - if (selectedProvider.hasCertificatePin()){ - parameters.putString(Provider.CA_CERT_FINGERPRINT, selectedProvider.certificatePin()); + parameters.putString(Provider.MAIN_URL, provider.getMainUrl().toString()); + if (provider.hasCertificatePin()){ + parameters.putString(Provider.CA_CERT_FINGERPRINT, provider.certificatePin()); } - if (selectedProvider.hasCaCert()) { - parameters.putString(Provider.CA_CERT, selectedProvider.getCaCert()); + if (provider.hasCaCert()) { + parameters.putString(Provider.CA_CERT, provider.getCaCert()); } - if (selectedProvider.hasDefinition()) { - parameters.putString(Provider.KEY, selectedProvider.getDefinition().toString()); + if (provider.hasDefinition()) { + parameters.putString(Provider.KEY, provider.getDefinition().toString()); } providerApiCommand.setAction(ProviderAPI.SET_UP_PROVIDER); @@ -87,14 +86,14 @@ public class ConfigurationWizard extends BaseConfigurationWizard { addAndSelectNewProvider(ProviderAPI.lastProviderMainUrl()); } else { showProgressBar(); - adapter.hideAllBut(adapter.indexOf(selectedProvider)); + adapter.hideAllBut(adapter.indexOf(provider)); 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, selectedProvider.getMainUrl().toString()); + parameters.putString(Provider.MAIN_URL, provider.getMainUrl().toString()); providerApiCommand.putExtra(ProviderAPI.PARAMETERS, parameters); startService(providerApiCommand); -- cgit v1.2.3