From 1ccb2f9e1bcfaf8279ef9576b3bca233e37af61b Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Thu, 18 Jan 2018 01:57:03 +0100 Subject: WizardConfiguration theme * download VPN certificate after loging in (#8813) * get the new design up to date (#8819) * fix crash when pressing login (#8817) * add a loading screen according to design (#8816) --- .../se/leap/bitmaskclient/ConfigurationWizard.java | 2 +- app/src/main/AndroidManifest.xml | 5 +- .../AbstractProviderDetailActivity.java | 27 ++--- .../bitmaskclient/BaseConfigurationWizard.java | 101 +++---------------- .../bitmaskclient/ConfigWizardBaseActivity.java | 111 +++++++++++++++++++++ .../java/se/leap/bitmaskclient/LoginActivity.java | 7 +- .../leap/bitmaskclient/ProviderApiManagerBase.java | 1 - .../ProviderCredentialsBaseActivity.java | 57 ++++------- .../java/se/leap/bitmaskclient/SignupActivity.java | 3 +- app/src/main/res/drawable/action_history.xml | 9 ++ .../configuration_wizard_activity.xml | 3 +- .../res/layout-xlarge/provider_detail_fragment.xml | 32 ++---- app/src/main/res/layout/a_login.xml | 45 +++++---- app/src/main/res/layout/a_signup.xml | 45 +++++---- .../res/layout/configuration_wizard_activity.xml | 40 ++++---- app/src/main/res/layout/loading_screen.xml | 41 ++++++++ .../main/res/layout/provider_credentials_login.xml | 6 +- .../main/res/layout/provider_detail_fragment.xml | 65 ++++++------ app/src/main/res/layout/provider_header.xml | 15 ++- app/src/main/res/values-v21/styles.xml | 5 + app/src/main/res/values-v21/themes.xml | 24 +++++ app/src/main/res/values/dimens.xml | 4 + app/src/main/res/values/strings.xml | 5 + app/src/main/res/values/styles.xml | 5 +- app/src/main/res/values/themes.xml | 8 +- 25 files changed, 390 insertions(+), 276 deletions(-) create mode 100644 app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java create mode 100644 app/src/main/res/drawable/action_history.xml create mode 100644 app/src/main/res/layout/loading_screen.xml create mode 100644 app/src/main/res/values-v21/themes.xml (limited to 'app') diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java index dc65665c..8a5a6190 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -77,7 +77,7 @@ public class ConfigurationWizard extends BaseConfigurationWizard { preferences.edit().putBoolean(ProviderItem.DANGER_ON, danger_on).apply(); selectedProvider = provider; onItemSelectedLogic(); - onItemSelectedUi(); + showProgressBar(); } /** diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0a10b13c..6e678f39 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,9 +102,10 @@ android:label="@string/provider_details_title" android:launchMode="singleTop" /> - + + android:noHistory="true" /> optionsList = new ArrayList<>(); if (registrationAllowed(providerJson)) { - optionsList.add(getString(R.string.login_button)); - optionsList.add(getString(R.string.signup_button)); + optionsList.add(getString(R.string.login_to_profile)); + optionsList.add(getString(R.string.create_profile)); } if (anonAllowed(providerJson)) { optionsList.add(getString(R.string.use_anonymously_button)); @@ -74,10 +63,10 @@ public abstract class AbstractProviderDetailActivity extends ButterKnifeActivity public void onItemClick(AdapterView parent, View view, int position, long id) { String text = ((TextView) view).getText().toString(); Intent intent; - if (text.equals(getString(R.string.login_button))) { + if (text.equals(getString(R.string.login_to_profile))) { Log.d(TAG, "login selected"); intent = new Intent(getApplicationContext(), LoginActivity.class); - } else if (text.equals(getString(R.string.signup_button))) { + } else if (text.equals(getString(R.string.create_profile))) { Log.d(TAG, "signup selected"); intent = new Intent(getApplicationContext(), SignupActivity.class); } else { diff --git a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java index d0868437..8e4f1607 100644 --- a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java +++ b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java @@ -21,21 +21,14 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentTransaction; import android.util.Log; -import android.view.Display; import android.view.Menu; import android.view.MenuItem; -import android.view.View; -import android.view.WindowManager; import android.widget.ListView; -import android.widget.ProgressBar; -import android.widget.RelativeLayout; -import android.widget.TextView; import com.pedrogomez.renderers.Renderer; @@ -53,12 +46,9 @@ import butterknife.OnItemClick; import se.leap.bitmaskclient.fragments.AboutFragment; import static android.view.View.GONE; -import static android.view.View.INVISIBLE; -import static android.view.View.VISIBLE; import static se.leap.bitmaskclient.Constants.APP_ACTION_QUIT; import static se.leap.bitmaskclient.Constants.PROVIDER_ALLOW_ANONYMOUS; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE; @@ -68,7 +58,6 @@ import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_OK; import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_SET_UP; import static se.leap.bitmaskclient.ProviderAPI.RESULT_CODE; import static se.leap.bitmaskclient.ProviderAPI.RESULT_KEY; -import static se.leap.bitmaskclient.ProviderAPI.UPDATE_PROGRESSBAR; /** * abstract base Activity that builds and shows the list of known available providers. @@ -81,12 +70,8 @@ import static se.leap.bitmaskclient.ProviderAPI.UPDATE_PROGRESSBAR; * @author cyberta */ -public abstract class BaseConfigurationWizard extends ButterKnifeActivity +public abstract class BaseConfigurationWizard extends ConfigWizardBaseActivity implements NewProviderDialog.NewProviderDialogInterface, DownloadFailedDialog.DownloadFailedDialogInterface, ProviderAPIResultReceiver.Receiver { - @InjectView(R.id.progressbar_configuration_wizard) - protected ProgressBar mProgressBar; - @InjectView(R.id.progressbar_description) - protected TextView progressbarDescription; @InjectView(R.id.provider_list) protected ListView providerListView; @@ -106,16 +91,12 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity final private static String REASON_TO_FAIL = "REASON TO FAIL"; final protected static String SERVICES_RETRIEVED = "SERVICES RETRIEVED"; - final private static String PROGRESSBAR_TEXT = TAG + "PROGRESSBAR_TEXT"; - final private static String PROGRESSBAR_NUMBER = TAG + "PROGRESSBAR_NUMBER"; final private static String ACTIVITY_STATE = "ACTIVITY STATE"; public ProviderAPIResultReceiver providerAPIResultReceiver; private ProviderAPIBroadcastReceiver providerAPIBroadcastReceiver; - protected static SharedPreferences preferences; FragmentManagerEnhanced fragmentManager; - //TODO: add some states (values for progressbarText) about ongoing setup or remove that field private boolean isActivityShowing; private String reasonToFail; @@ -135,10 +116,8 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity @Override protected void onSaveInstanceState(@NotNull Bundle outState) { - if (mProgressBar != null) - outState.putInt(PROGRESSBAR_NUMBER, mProgressBar.getProgress()); - if (progressbarDescription != null) - outState.putString(PROGRESSBAR_TEXT, progressbarDescription.getText().toString()); + //if (progressbarDescription != null) + // outState.putString(PROGRESSBAR_TEXT, progressbarDescription.getText().toString()); outState.putString(ACTIVITY_STATE, mConfigState.getAction()); outState.putParcelable(Provider.KEY, selectedProvider); @@ -154,7 +133,6 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); fragmentManager = new FragmentManagerEnhanced(getSupportFragmentManager()); providerManager = ProviderManager.getInstance(getAssets(), getExternalFilesDir(null)); @@ -180,7 +158,7 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity if (SETTING_UP_PROVIDER.equals(mConfigState.getAction()) || PENDING_SHOW_FAILED_DIALOG.equals(mConfigState.getAction()) ) { - onItemSelectedUi(); + showProgressBar(); } } @@ -203,22 +181,10 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity private void setUpInitialUI() { setContentView(R.layout.configuration_wizard_activity); + setProviderHeaderText(R.string.setup_provider); hideProgressBar(); } - private void hideProgressBar() { - //needs to be "INVISIBLE" instead of GONE b/c the progressbarDescription gets translated - // by the height of mProgressbar (and the height of the first list item) - mProgressBar.setVisibility(INVISIBLE); - progressbarDescription.setVisibility(INVISIBLE); - mProgressBar.setProgress(0); - } - - protected void showProgressBar() { - mProgressBar.setVisibility(VISIBLE); - progressbarDescription.setVisibility(VISIBLE); - } - @Override protected void onPause() { super.onPause(); @@ -237,8 +203,7 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity providerAPIResultReceiver = new ProviderAPIResultReceiver(new Handler(), this); providerAPIBroadcastReceiver = new ProviderAPIBroadcastReceiver(); - IntentFilter updateIntentFilter = new IntentFilter(UPDATE_PROGRESSBAR); - updateIntentFilter.addAction(PROVIDER_API_EVENT); + IntentFilter updateIntentFilter = new IntentFilter(PROVIDER_API_EVENT); updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT); registerReceiver(providerAPIBroadcastReceiver, updateIntentFilter); } @@ -259,9 +224,6 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity downloadVpnCertificate(); } else { - mProgressBar.incrementProgressBy(1); - hideProgressBar(); - showProviderDetails(); } } @@ -277,8 +239,6 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity } void handleCorrectlyDownloadedCertificate() { - mProgressBar.incrementProgressBy(1); - hideProgressBar(); showProviderDetails(); } @@ -308,15 +268,10 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity //TODO Code 2 pane view mConfigState.setAction(SETTING_UP_PROVIDER); selectedProvider = adapter.getItem(position); - onItemSelectedUi(); + showProgressBar(); onItemSelectedLogic(); } - protected void onItemSelectedUi() { - adapter.hideAllBut(adapter.indexOf(selectedProvider)); - startProgressBar(); - } - @Override public void onBackPressed() { if (SETTING_UP_PROVIDER.equals(mConfigState.getAction()) || @@ -330,9 +285,7 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity private void stopSettingUpProvider() { ProviderAPI.stop(); - mProgressBar.setVisibility(GONE); - mProgressBar.setProgress(0); - progressbarDescription.setVisibility(GONE); + loadingScreen.setVisibility(GONE); cancelSettingUpProvider(); } @@ -371,34 +324,6 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity setResult(RESULT_CANCELED, askQuit); } - private void startProgressBar() { - showProgressBar(); - mProgressBar.setProgress(0); - mProgressBar.setMax(3); - - int measured_height = listItemHeight(); - mProgressBar.setTranslationY(measured_height); - progressbarDescription.setTranslationY(measured_height + mProgressBar.getHeight()); - } - - private int listItemHeight() { - View listItem = adapter.getView(0, null, providerListView); - listItem.setLayoutParams(new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT)); - WindowManager wm = (WindowManager) getApplicationContext() - .getSystemService(Context.WINDOW_SERVICE); - Display display = wm.getDefaultDisplay(); - int screenWidth = display.getWidth(); // deprecated - - int listViewWidth = screenWidth - 10 - 10; - int widthSpec = View.MeasureSpec.makeMeasureSpec(listViewWidth, - View.MeasureSpec.AT_MOST); - listItem.measure(widthSpec, 0); - - return listItem.getMeasuredHeight(); - } - /** * Asks ProviderApiService to download an anonymous (anon) VPN certificate. */ @@ -461,7 +386,8 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity */ public void showProviderDetails() { // show only if current activity is shown - if (isActivityShowing && !mConfigState.getAction().equalsIgnoreCase(SHOWING_PROVIDER_DETAILS)) { + if (isActivityShowing && mConfigState.getAction() != null && + !mConfigState.getAction().equalsIgnoreCase(SHOWING_PROVIDER_DETAILS)) { mConfigState.setAction(SHOWING_PROVIDER_DETAILS); Intent intent = new Intent(this, ProviderDetailActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); @@ -504,10 +430,9 @@ public abstract class BaseConfigurationWizard extends ButterKnifeActivity return; } - if (action.equalsIgnoreCase(UPDATE_PROGRESSBAR)) { - int update = intent.getIntExtra(ProviderAPI.CURRENT_PROGRESS, 0); - mProgressBar.setProgress(update); - } else if (action.equalsIgnoreCase(PROVIDER_API_EVENT)) { + // TODO check if correct provider given + if (action.equalsIgnoreCase(PROVIDER_API_EVENT) && mConfigState.getAction() != null && + mConfigState.getAction().equalsIgnoreCase(SETTING_UP_PROVIDER)) { int resultCode = intent.getIntExtra(RESULT_CODE, -1); switch (resultCode) { diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java new file mode 100644 index 00000000..3e83d9bc --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java @@ -0,0 +1,111 @@ +package se.leap.bitmaskclient; + +import android.content.SharedPreferences; +import android.os.Bundle; +import android.support.annotation.DrawableRes; +import android.support.annotation.Nullable; +import android.support.annotation.StringRes; +import android.support.v7.widget.AppCompatImageView; +import android.support.v7.widget.AppCompatTextView; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; + +import org.json.JSONException; +import org.json.JSONObject; + +import butterknife.InjectView; + +import static android.view.View.GONE; +import static android.view.View.VISIBLE; +import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; + +/** + * Base Activity for configuration wizard activities + * + * Created by fupduck on 09.01.18. + */ + +public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { + + protected SharedPreferences preferences; + + @InjectView(R.id.provider_header_logo) + AppCompatImageView providerHeaderLogo; + + @InjectView(R.id.provider_header_text) + AppCompatTextView providerHeaderText; + + @InjectView(R.id.loading_screen) + protected LinearLayout loadingScreen; + + @InjectView(R.id.progressbar_description) + protected AppCompatTextView progressbarText; + + @InjectView(R.id.content) + protected LinearLayout content; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); + } + + @Override + public void setContentView(View view) { + super.setContentView(view); + setProviderHeaderText(getProviderName()); + } + + @Override + public void setContentView(int layoutResID) { + super.setContentView(layoutResID); + setProviderHeaderText(getProviderName()); + } + + @Override + public void setContentView(View view, ViewGroup.LayoutParams params) { + super.setContentView(view, params); + setProviderHeaderText(getProviderName()); + } + + protected void setProviderHeaderLogo(@DrawableRes int providerHeaderLogo) { + this.providerHeaderLogo.setImageResource(providerHeaderLogo); + } + + protected void setProviderHeaderText(String providerHeaderText) { + this.providerHeaderText.setText(providerHeaderText); + } + + protected void setProviderHeaderText(@StringRes int providerHeaderText) { + this.providerHeaderText.setText(providerHeaderText); + } + + protected String getProviderName() { + try { + JSONObject providerJson = new JSONObject(preferences.getString(Provider.KEY, "")); + return providerJson.getJSONObject(Provider.NAME).getString("en"); + } catch (JSONException e) { + return null; + } + } + + protected void hideProgressBar() { + loadingScreen.setVisibility(GONE); + content.setVisibility(VISIBLE); + } + + protected void showProgressBar() { + content.setVisibility(GONE); + loadingScreen.setVisibility(VISIBLE); + } + + protected void setProgressbarText(String progressbarText) { + this.progressbarText.setText(progressbarText); + } + + protected void setProgressbarText(@StringRes int progressbarText) { + this.progressbarText.setText(progressbarText); + } + +} diff --git a/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java b/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java index a5cbf5f5..06cf5b89 100644 --- a/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java @@ -2,11 +2,12 @@ package se.leap.bitmaskclient; import android.os.Bundle; import android.support.annotation.Nullable; -import android.util.Log; import butterknife.OnClick; /** + * Activity to login to chosen Provider + * * Created by fupduck on 09.01.18. */ @@ -16,9 +17,9 @@ public class LoginActivity extends ProviderCredentialsBaseActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.a_login); - - setProviderHeaderText("providerNAME"); + setProgressbarText(R.string.logging_in); setProviderHeaderLogo(R.drawable.mask); + setProviderHeaderText(R.string.login_to_profile); } @Override diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java index da2e4c8b..cfc6e49d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java @@ -96,7 +96,6 @@ import static se.leap.bitmaskclient.R.string.error_io_exception_user_message; import static se.leap.bitmaskclient.R.string.error_json_exception_user_message; import static se.leap.bitmaskclient.R.string.error_no_such_algorithm_exception_user_message; import static se.leap.bitmaskclient.R.string.malformed_url; -import static se.leap.bitmaskclient.R.string.routes_info_excl; import static se.leap.bitmaskclient.R.string.server_unreachable_message; import static se.leap.bitmaskclient.R.string.service_is_down_error; import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_cert; diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java index c61b078f..c15481e5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java @@ -3,13 +3,10 @@ package se.leap.bitmaskclient; import android.content.Intent; import android.os.Bundle; import android.os.Handler; -import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.design.widget.TextInputEditText; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.TextView; +import android.support.v7.widget.AppCompatButton; import butterknife.InjectView; import butterknife.OnClick; @@ -17,19 +14,15 @@ import se.leap.bitmaskclient.userstatus.SessionDialog; import se.leap.bitmaskclient.userstatus.User; /** + * Base Activity for activities concerning a provider interaction + * * Created by fupduck on 09.01.18. */ -public abstract class ProviderCredentialsBaseActivity extends ButterKnifeActivity { +public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseActivity { protected ProviderAPIResultReceiver providerAPIResultReceiver; - @InjectView(R.id.provider_header_logo) - ImageView providerHeaderLogo; - - @InjectView(R.id.provider_header_text) - TextView providerHeaderText; - @InjectView(R.id.provider_credentials_username) TextInputEditText providerCredentialsUsername; @@ -37,30 +30,17 @@ public abstract class ProviderCredentialsBaseActivity extends ButterKnifeActivit TextInputEditText providerCredentialsPassword; @InjectView(R.id.button) - Button providerCredentialsButton; + AppCompatButton providerCredentialsButton; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); providerAPIResultReceiver = new ProviderAPIResultReceiver(new Handler(), new ProviderCredentialsReceiver(this)); - } @OnClick(R.id.button) abstract void handleButton(); - protected void setProviderHeaderLogo(@DrawableRes int providerHeaderLogo) { - this.providerHeaderLogo.setImageResource(providerHeaderLogo); - } - - protected void setProviderHeaderText(String providerHeaderText) { - this.providerHeaderText.setText(providerHeaderText); - } - - protected void setProviderHeaderText(@StringRes int providerHeaderText) { - this.providerHeaderText.setText(providerHeaderText); - } - protected void setButtonText(@StringRes int buttonText) { providerCredentialsButton.setText(buttonText); } @@ -74,16 +54,25 @@ public abstract class ProviderCredentialsBaseActivity extends ButterKnifeActivit } void login(String username, String password) { + showProgressBar(); User.setUserName(username); Bundle parameters = bundlePassword(password); ProviderAPICommand.execute(parameters, ProviderAPI.LOG_IN, providerAPIResultReceiver); } + void downloadVpnCertificate() { + Intent providerAPICommand = new Intent(this, ProviderAPI.class); + ProviderAPICommand.execute(Bundle.EMPTY, ProviderAPI.DOWNLOAD_CERTIFICATE, providerAPIResultReceiver); + } + + public void signUp(String username, String password) { + showProgressBar(); User.setUserName(username); Bundle parameters = bundlePassword(password); ProviderAPICommand.execute(parameters, ProviderAPI.SIGN_UP, providerAPIResultReceiver); } + protected Bundle bundlePassword(String password) { Bundle parameters = new Bundle(); if (!password.isEmpty()) @@ -102,14 +91,11 @@ public abstract class ProviderCredentialsBaseActivity extends ButterKnifeActivit @Override public void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode == ProviderAPI.SUCCESSFUL_SIGNUP) { - String username = resultData.getString(SessionDialog.USERNAME); - String password = resultData.getString(SessionDialog.PASSWORD); - activity.login(username, password); + activity.downloadVpnCertificate(); } else if (resultCode == ProviderAPI.FAILED_SIGNUP) { //MainActivity.sessionDialog(resultData); } else if (resultCode == ProviderAPI.SUCCESSFUL_LOGIN) { - Intent intent = new Intent(activity, MainActivity.class); - activity.startActivity(intent); + activity.downloadVpnCertificate(); } else if (resultCode == ProviderAPI.FAILED_LOGIN) { //MainActivity.sessionDialog(resultData); // TODO MOVE @@ -117,11 +103,12 @@ public abstract class ProviderCredentialsBaseActivity extends ButterKnifeActivit // if (switching_provider) activity.switchProvider(); // } else if (resultCode == ProviderAPI.LOGOUT_FAILED) { // activity.setResult(RESULT_CANCELED); -// } else if (resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) { -// activity.eip_fragment.updateEipService(); -// activity.setResult(RESULT_OK); -// } else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { -// activity.setResult(RESULT_CANCELED); + } else if (resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) { + Intent intent = new Intent(activity, MainActivity.class); + activity.startActivity(intent); + //activity.eip_fragment.updateEipService(); + } else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { + // TODO activity.setResult(RESULT_CANCELED); // } else if (resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE) { // activity.eip_fragment.updateEipService(); // activity.setResult(RESULT_OK); diff --git a/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java b/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java index f6344065..448eba52 100644 --- a/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java @@ -27,9 +27,10 @@ public class SignupActivity extends ProviderCredentialsBaseActivity { super.onCreate(savedInstanceState); setContentView(R.layout.a_signup); - setProviderHeaderText("providerNAME"); setProviderHeaderLogo(R.drawable.mask); + setProviderHeaderText(R.string.create_profile); + setProgressbarText(R.string.signing_up); setButtonText(R.string.signup_button); providerCredentialsPasswordVerification.addTextChangedListener(new TextWatcher() { diff --git a/app/src/main/res/drawable/action_history.xml b/app/src/main/res/drawable/action_history.xml new file mode 100644 index 00000000..97c7c6dc --- /dev/null +++ b/app/src/main/res/drawable/action_history.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml b/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml index 50bb5d0b..f82377cb 100644 --- a/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml +++ b/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml @@ -3,7 +3,8 @@ android:id="@+id/configuration_wizard_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ConfigurationWizard" > + tools:context=".ConfigurationWizard" + style="@style/BitmaskActivity" > + android:orientation="vertical" + style="@style/BitmaskActivity" > - + - - @@ -43,6 +25,8 @@ + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/standard_margin" + /> \ 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 index 5ecb807c..5b33ec16 100644 --- a/app/src/main/res/layout/a_login.xml +++ b/app/src/main/res/layout/a_login.xml @@ -1,29 +1,38 @@ + android:layout_height="match_parent" + style="@style/BitmaskActivity"> - + - + android:layout_height="match_parent" + android:orientation="vertical"> - + + + -