diff options
Diffstat (limited to 'app/src/main')
46 files changed, 17 insertions, 3368 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cf4f6150..7d1ee39f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -92,21 +92,6 @@ android:name=".base.MainActivity" android:label="@string/app_name" android:launchMode="singleTop" /> - <activity - android:name=".providersetup.ProviderListActivity" - android:label="@string/configuration_wizard_title" /> - <activity - android:name=".providersetup.activities.CustomProviderSetupActivity" - android:label="@string/setup_provider" /> - <activity - android:name=".providersetup.AddProviderActivity" - android:label="@string/add_provider" /> - <activity - android:name=".providersetup.ProviderDetailActivity" - android:label="@string/provider_details_title" - android:launchMode="singleTop" /> - <activity android:name=".providersetup.activities.LoginActivity" /> - <activity android:name=".providersetup.activities.SignupActivity" /> <service android:name=".eip.EIP" diff --git a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java index 7dd01ccb..5da238d4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java @@ -19,7 +19,6 @@ package se.leap.bitmaskclient.base; import static androidx.appcompat.app.ActionBar.DISPLAY_SHOW_CUSTOM; import static se.leap.bitmaskclient.R.string.downloading_vpn_certificate_failed; -import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; import static se.leap.bitmaskclient.base.models.Constants.ASK_TO_CANCEL_VPN; import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; @@ -42,11 +41,9 @@ import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_UPDATE import static se.leap.bitmaskclient.providersetup.ProviderAPI.TOR_EXCEPTION; import static se.leap.bitmaskclient.providersetup.ProviderAPI.TOR_TIMEOUT; import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; import android.content.Context; import android.content.Intent; -import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.Gravity; @@ -69,7 +66,6 @@ import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.fragments.EipFragment; import se.leap.bitmaskclient.base.fragments.ExcludeAppsFragment; -import se.leap.bitmaskclient.base.fragments.LogFragment; import se.leap.bitmaskclient.base.fragments.MainActivityErrorDialog; import se.leap.bitmaskclient.base.fragments.MotdFragment; import se.leap.bitmaskclient.base.fragments.NavigationDrawerFragment; @@ -83,8 +79,6 @@ import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipSetupListener; import se.leap.bitmaskclient.eip.EipSetupObserver; import se.leap.bitmaskclient.providersetup.ProviderAPI; -import se.leap.bitmaskclient.providersetup.activities.LoginActivity; -import se.leap.bitmaskclient.providersetup.models.LeapSRPSession; public class MainActivity extends AppCompatActivity implements EipSetupListener, Observer { @@ -310,10 +304,10 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener, return; } - if (LeapSRPSession.loggedIn() || provider.allowsAnonymous()) { + if (provider.allowsAnonymous()) { showMainActivityErrorDialog(error); } else if (isInvalidCertificateForLoginOnlyProvider(error)) { - askUserToLogIn(getString(vpn_certificate_user_message)); + showMainActivityErrorDialog(getString(R.string.login_not_supported)); } } break; @@ -341,11 +335,7 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener, // TODO CATCH ME IF YOU CAN - WHAT DO WE WANT TO DO? break; case INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE: - if (LeapSRPSession.loggedIn() || provider.allowsAnonymous()) { showMainActivityErrorDialog(getString(downloading_vpn_certificate_failed)); - } else { - askUserToLogIn(getString(vpn_certificate_user_message)); - } break; case TOR_TIMEOUT: case TOR_EXCEPTION: @@ -429,20 +419,11 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener, try { JSONObject errorJson = new JSONObject(errorJsonString); return ERROR_INVALID_VPN_CERTIFICATE.toString().equals(errorJson.getString(ERRORID)) && - !LeapSRPSession.loggedIn() && + provider.allowsRegistered() && !provider.allowsAnonymous(); } catch (JSONException e) { e.printStackTrace(); } return false; } - - private void askUserToLogIn(String userMessage) { - Intent intent = new Intent(this, LoginActivity.class); - intent.putExtra(PROVIDER_KEY, provider); - if (userMessage != null) { - intent.putExtra(USER_MESSAGE, userMessage); - } - startActivityForResult(intent, REQUEST_CODE_LOG_IN); - } } diff --git a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java index 19f03dee..21fc81e4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java @@ -24,7 +24,6 @@ import static se.leap.bitmaskclient.base.models.Constants.EXTRA_MOTD_MSG; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_EIP_DEFINITION; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.storeProviderInPreferences; import android.app.Activity; @@ -52,7 +51,6 @@ import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.base.utils.DateHelper; import se.leap.bitmaskclient.base.utils.PreferenceHelper; import se.leap.bitmaskclient.eip.EipCommand; -import se.leap.bitmaskclient.providersetup.activities.CustomProviderSetupActivity; import se.leap.bitmaskclient.providersetup.activities.SetupActivity; /** diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index 670cdfd8..c500b55b 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -16,21 +16,16 @@ */ package se.leap.bitmaskclient.base.fragments; -import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; import static se.leap.bitmaskclient.base.models.Constants.ASK_TO_CANCEL_VPN; import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; import static se.leap.bitmaskclient.base.models.Constants.EIP_EARLY_ROUTES; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_LOG_IN; import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; -import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity; import static se.leap.bitmaskclient.eip.EipSetupObserver.reconnectingWithDifferentGateway; import static se.leap.bitmaskclient.eip.GatewaysManager.Load.UNKNOWN; import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_GEOIP_JSON; import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; import android.app.Activity; import android.content.Context; @@ -46,6 +41,7 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Toast; import androidx.annotation.ColorRes; import androidx.annotation.DrawableRes; @@ -80,10 +76,7 @@ import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; import se.leap.bitmaskclient.eip.GatewaysManager; import se.leap.bitmaskclient.providersetup.ProviderAPICommand; -import se.leap.bitmaskclient.providersetup.ProviderListActivity; -import se.leap.bitmaskclient.providersetup.activities.CustomProviderSetupActivity; -import se.leap.bitmaskclient.providersetup.activities.LoginActivity; -import se.leap.bitmaskclient.providersetup.models.LeapSRPSession; +import se.leap.bitmaskclient.providersetup.activities.SetupActivity; import se.leap.bitmaskclient.tor.TorServiceCommand; import se.leap.bitmaskclient.tor.TorStatusObservable; @@ -136,14 +129,7 @@ public class EipFragment extends Fragment implements Observer { } private void handleNoProvider(Activity activity) { - if (isDefaultBitmask()) { - activity.startActivityForResult(new Intent(activity, ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER); - } else { - Log.e(TAG, "no provider given - try to reconfigure custom provider"); - startActivityForResult(new Intent(activity, CustomProviderSetupActivity.class), REQUEST_CODE_CONFIGURE_LEAP); - - } - + activity.startActivityForResult(new Intent(activity, SetupActivity.class), REQUEST_CODE_SWITCH_PROVIDER); } @Override @@ -283,11 +269,10 @@ public class EipFragment extends Fragment implements Observer { if (canStartEIP()) { startEipFromScratch(); - } else if (canLogInToStartEIP()) { - askUserToLogIn(getString(vpn_certificate_user_message)); - } else { - // provider has no VpnCertificate but user is logged in + } else if (provider.allowsAnonymous()){ updateInvalidVpnCertificate(); + } else { + Toast.makeText(getContext(), R.string.config_error_found, Toast.LENGTH_LONG).show(); } } @@ -297,12 +282,6 @@ public class EipFragment extends Fragment implements Observer { return (isAllowedAnon || certificateExists) && !eipStatus.isConnected() && !eipStatus.isConnecting(); } - private boolean canLogInToStartEIP() { - boolean isAllowedRegistered = provider.allowsRegistered(); - boolean isLoggedIn = LeapSRPSession.loggedIn(); - return isAllowedRegistered && !isLoggedIn && !eipStatus.isConnecting() && !eipStatus.isConnected(); - } - private void handleSwitchOff() { if (eipStatus.isVPNRunningWithoutNetwork() || eipStatus.isConnecting() || eipStatus.isUpdatingVpnCert()) { askPendingStartCancellation(); @@ -562,7 +541,6 @@ public class EipFragment extends Fragment implements Observer { // eat me } - stateView.setImageResource(drawableRes); stateView.setTag(drawableRes); if (stateView.getDrawable() instanceof Animatable) { @@ -592,20 +570,6 @@ public class EipFragment extends Fragment implements Observer { ProviderAPICommand.execute(getContext(), UPDATE_INVALID_VPN_CERTIFICATE, provider); } - private void askUserToLogIn(String userMessage) { - Intent intent = new Intent(getContext(), LoginActivity.class); - intent.putExtra(PROVIDER_KEY, provider); - - if(userMessage != null) { - intent.putExtra(USER_MESSAGE, userMessage); - } - - Activity activity = getActivity(); - if (activity != null) { - activity.startActivityForResult(intent, REQUEST_CODE_LOG_IN); - } - } - public void showDonationReminderDialog() { try { FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced( diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java b/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java deleted file mode 100644 index 811a54a2..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java +++ /dev/null @@ -1,109 +0,0 @@ -package se.leap.bitmaskclient.base.views; - -import android.content.Context; -import androidx.annotation.DrawableRes; -import androidx.annotation.RequiresApi; -import androidx.annotation.StringRes; -import androidx.appcompat.widget.AppCompatImageView; -import androidx.appcompat.widget.AppCompatTextView; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.RelativeLayout; - -import se.leap.bitmaskclient.R; - -import static se.leap.bitmaskclient.base.utils.ViewHelper.convertDimensionToPx; - -/** - * Created by cyberta on 29.06.18. - */ - -public class ProviderHeaderView extends RelativeLayout { - private int stdPadding; - private int compactPadding; - private int stdImageSize; - private int compactImageSize; - - AppCompatImageView providerHeaderLogo; - AppCompatTextView providerHeaderText; - - public ProviderHeaderView(Context context) { - super(context); - initLayout(context); - } - - public ProviderHeaderView(Context context, AttributeSet attrs) { - super(context, attrs); - initLayout(context); - } - - public ProviderHeaderView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initLayout(context); - } - - @RequiresApi(21) - public ProviderHeaderView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - initLayout(context); - } - - - void initLayout(Context context) { - LayoutInflater inflater = (LayoutInflater) context - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View rootview = inflater.inflate(R.layout.v_provider_header, this, true); - providerHeaderLogo = rootview.findViewById(R.id.provider_header_logo); - providerHeaderText = rootview.findViewById(R.id.provider_header_text); - - stdPadding = convertDimensionToPx(context, R.dimen.stdpadding); - compactPadding = convertDimensionToPx(context, R.dimen.compact_padding); - stdImageSize = convertDimensionToPx(context, R.dimen.bitmask_logo); - compactImageSize = convertDimensionToPx(context, R.dimen.bitmask_logo_compact); - } - - public void setTitle(String title) { - providerHeaderText.setText(title); - } - - public void setTitle(@StringRes int stringRes) { - providerHeaderText.setText(stringRes); - } - - public void setLogo(@DrawableRes int drawableRes) { - providerHeaderLogo.setImageResource(drawableRes); - } - - public void showCompactLayout() { - LayoutParams logoLayoutParams = (LayoutParams) providerHeaderLogo.getLayoutParams(); - logoLayoutParams.width = compactImageSize; - logoLayoutParams.height = compactImageSize; - providerHeaderLogo.setLayoutParams(logoLayoutParams); - - LayoutParams textLayoutParams = (LayoutParams) providerHeaderText.getLayoutParams(); - textLayoutParams.addRule(RIGHT_OF, R.id.provider_header_logo); - textLayoutParams.addRule(BELOW, 0); - textLayoutParams.addRule(ALIGN_TOP, R.id.provider_header_logo); - textLayoutParams.setMargins(compactPadding, compactPadding, compactPadding, compactPadding); - - providerHeaderText.setLayoutParams(textLayoutParams); - providerHeaderText.setMaxLines(2); - } - - public void showStandardLayout() { - LayoutParams logoLayoutParams = (LayoutParams) providerHeaderLogo.getLayoutParams(); - logoLayoutParams.width = stdImageSize; - logoLayoutParams.height = stdImageSize; - providerHeaderLogo.setLayoutParams(logoLayoutParams); - - LayoutParams textLayoutParams = (LayoutParams) providerHeaderText.getLayoutParams(); - textLayoutParams.addRule(RIGHT_OF, 0); - textLayoutParams.addRule(BELOW, R.id.provider_header_logo); - textLayoutParams.addRule(ALIGN_TOP, 0); - textLayoutParams.setMargins(stdPadding, stdPadding, stdPadding, stdPadding); - providerHeaderText.setLayoutParams(textLayoutParams); - providerHeaderText.setMaxLines(1); - } - -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiSetupBroadcastReceiver.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiSetupBroadcastReceiver.java index 4b7d22fc..ee39499b 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiSetupBroadcastReceiver.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiSetupBroadcastReceiver.java @@ -16,6 +16,8 @@ */ package se.leap.bitmaskclient.providersetup; +import static android.app.Activity.RESULT_CANCELED; + import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -27,7 +29,6 @@ import java.lang.ref.WeakReference; import se.leap.bitmaskclient.base.models.Constants; import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState; -import se.leap.bitmaskclient.providersetup.activities.ProviderListBaseActivity; /** * Broadcast receiver that handles callback intents of ProviderApi during provider setup. @@ -38,6 +39,7 @@ import se.leap.bitmaskclient.providersetup.activities.ProviderListBaseActivity; */ public class ProviderApiSetupBroadcastReceiver extends BroadcastReceiver { + private static final String TAG = ProviderApiSetupBroadcastReceiver.class.getSimpleName(); private final WeakReference<ProviderSetupInterface> setupInterfaceRef; public ProviderApiSetupBroadcastReceiver(ProviderSetupInterface setupInterface) { @@ -46,7 +48,7 @@ public class ProviderApiSetupBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - Log.d(ProviderListBaseActivity.TAG, "received Broadcast"); + Log.d(TAG, "received Broadcast"); ProviderSetupInterface setupInterface = setupInterfaceRef.get(); String action = intent.getAction(); if (action == null || !action.equalsIgnoreCase(Constants.BROADCAST_PROVIDER_API_EVENT) || setupInterface == null) { @@ -55,8 +57,8 @@ public class ProviderApiSetupBroadcastReceiver extends BroadcastReceiver { if (setupInterface.getConfigState() != null && setupInterface.getConfigState() == ProviderConfigState.SETTING_UP_PROVIDER) { - int resultCode = intent.getIntExtra(Constants.BROADCAST_RESULT_CODE, ProviderListBaseActivity.RESULT_CANCELED); - Log.d(ProviderListBaseActivity.TAG, "Broadcast resultCode: " + resultCode); + int resultCode = intent.getIntExtra(Constants.BROADCAST_RESULT_CODE, RESULT_CANCELED); + Log.d(TAG, "Broadcast resultCode: " + resultCode); Bundle resultData = intent.getParcelableExtra(Constants.BROADCAST_RESULT_KEY); Provider handledProvider = resultData.getParcelable(Constants.PROVIDER_KEY); diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderListAdapter.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderListAdapter.java deleted file mode 100644 index 76ee33f2..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderListAdapter.java +++ /dev/null @@ -1,21 +0,0 @@ -package se.leap.bitmaskclient.providersetup; - -import android.view.LayoutInflater; - -import com.pedrogomez.renderers.AdapteeCollection; -import com.pedrogomez.renderers.RendererAdapter; -import com.pedrogomez.renderers.RendererBuilder; - -import se.leap.bitmaskclient.base.models.Provider; - -public class ProviderListAdapter extends RendererAdapter<Provider> { - public ProviderListAdapter(LayoutInflater layoutInflater, RendererBuilder rendererBuilder, - AdapteeCollection<Provider> collection) { - super(layoutInflater, rendererBuilder, collection); - } - - public void saveProviders() { - ProviderManager provider_manager = (ProviderManager) getCollection(); - provider_manager.saveCustomProvidersToFile(); - } -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java index b46072ff..38198f89 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java @@ -19,8 +19,6 @@ import android.content.res.AssetManager; import androidx.annotation.VisibleForTesting; -import com.pedrogomez.renderers.AdapteeCollection; - import org.json.JSONObject; import java.io.File; @@ -39,7 +37,7 @@ import se.leap.bitmaskclient.base.models.Provider; /** * Created by parmegv on 4/12/14. */ -public class ProviderManager implements AdapteeCollection<Provider> { +public class ProviderManager { private final AssetManager assetsManager; private File externalFilesDir; @@ -165,12 +163,10 @@ public class ProviderManager implements AdapteeCollection<Provider> { return allProviders; } - @Override public int size() { return providers().size(); } - @Override public Provider get(int index) { Iterator<Provider> iterator = providers().iterator(); while (iterator.hasNext() && index > 0) { @@ -180,7 +176,6 @@ public class ProviderManager implements AdapteeCollection<Provider> { return iterator.next(); } - @Override public boolean add(Provider element) { return element != null && !defaultProviderURLs.contains(element.getMainUrl().toString()) && @@ -188,14 +183,12 @@ public class ProviderManager implements AdapteeCollection<Provider> { customProviderURLs.add(element.getMainUrl().toString()); } - @Override public boolean remove(Object element) { return element instanceof Provider && customProviders.remove(element) && customProviderURLs.remove(((Provider) element).getMainUrl().toString()); } - @Override public boolean addAll(Collection<? extends Provider> elements) { Iterator iterator = elements.iterator(); boolean addedAll = true; @@ -208,7 +201,6 @@ public class ProviderManager implements AdapteeCollection<Provider> { return addedAll; } - @Override public boolean removeAll(Collection<?> elements) { Iterator iterator = elements.iterator(); boolean removedAll = true; @@ -226,7 +218,6 @@ public class ProviderManager implements AdapteeCollection<Provider> { return removedAll; } - @Override public void clear() { defaultProviders.clear(); customProviders.clear(); diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java deleted file mode 100644 index 8aba4941..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java +++ /dev/null @@ -1,61 +0,0 @@ -package se.leap.bitmaskclient.providersetup; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.appcompat.widget.AppCompatTextView; - -import com.pedrogomez.renderers.Renderer; - -import butterknife.BindView; -import butterknife.ButterKnife; -import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.base.models.Provider; - -/** - * Created by parmegv on 4/12/14. - */ -public class ProviderRenderer extends Renderer<Provider> { - private final Context context; - - @BindView(R.id.provider_name) - AppCompatTextView name; - @BindView(R.id.provider_domain) - AppCompatTextView domain; - - public ProviderRenderer(Context context) { - this.context = context; - } - - @Override - protected View inflate(LayoutInflater inflater, ViewGroup parent) { - View view = inflater.inflate(R.layout.v_provider_list_item, parent, false); - ButterKnife.bind(this, view); - return view; - } - - @Override - protected void setUpView(View rootView) { - /* - * Empty implementation substituted with the usage of ButterKnife library by Jake Wharton. - */ - } - - @Override - protected void hookListeners(View rootView) { - //Empty - } - - @Override - public void render() { - Provider provider = getContent(); - if (!provider.isDefault()) { - name.setText(provider.getName()); - domain.setText(provider.getDomain()); - } else { - domain.setText(R.string.add_provider); - } - } -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRendererBuilder.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRendererBuilder.java deleted file mode 100644 index 7d2b4742..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRendererBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -package se.leap.bitmaskclient.providersetup; - -import com.pedrogomez.renderers.*; - -import java.util.*; - -import se.leap.bitmaskclient.base.models.Provider; - -/** - * Created by parmegv on 4/12/14. - */ -public class ProviderRendererBuilder extends RendererBuilder<Provider> { - public ProviderRendererBuilder(Collection<Renderer<Provider>> prototypes) { - super(prototypes); - } - - @Override - protected Class getPrototypeClass(Provider content) { - return ProviderRenderer.class; - } -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/TorLogAdapter.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/TorLogAdapter.java index 3df0fd94..816d4690 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/TorLogAdapter.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/TorLogAdapter.java @@ -11,7 +11,6 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.List; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.providersetup.activities.ConfigWizardBaseActivity; public class TorLogAdapter extends RecyclerView.Adapter<TorLogAdapter.ViewHolder> { private List<String> values; diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java deleted file mode 100644 index 66999580..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java +++ /dev/null @@ -1,108 +0,0 @@ -package se.leap.bitmaskclient.providersetup.activities; - -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatTextView; -import android.util.Log; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.TextView; - -import java.util.ArrayList; - - -import butterknife.BindView; -import se.leap.bitmaskclient.base.models.Provider; -import se.leap.bitmaskclient.R; - -import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; - -public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseActivity { - - final public static String TAG = "providerDetailActivity"; - - @BindView(R.id.provider_detail_description) - AppCompatTextView description; - - @BindView(R.id.provider_detail_options) - ListView options; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - provider = getIntent().getParcelableExtra(PROVIDER_KEY); - setContentView(R.layout.a_provider_detail); - - if (provider == null) { - return; - } - - setProviderHeaderText(provider.getName()); - description.setText(provider.getDescription()); - - // Show only the options allowed by the provider - ArrayList<String> optionsList = new ArrayList<>(); - if (provider.allowsRegistered()) { - optionsList.add(getString(R.string.login_to_profile)); - optionsList.add(getString(R.string.create_profile)); - if (provider.allowsAnonymous()) { - optionsList.add(getString(R.string.use_anonymously_button)); - } - } else { - onAnonymouslySelected(); - } - - options.setAdapter(new ArrayAdapter<>( - this, - R.layout.v_single_list_item, - android.R.id.text1, - optionsList.toArray(new String[optionsList.size()]) - )); - options.setOnItemClickListener((parent, view, position, id) -> { - String text = ((AppCompatTextView) view).getText().toString(); - Intent intent; - 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.create_profile))) { - Log.d(TAG, "signup selected"); - intent = new Intent(getApplicationContext(), SignupActivity.class); - } else { - onAnonymouslySelected(); - return; - } - intent.putExtra(PROVIDER_KEY, provider); - intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); - startActivityForResult(intent, REQUEST_CODE_CONFIGURE_LEAP); - }); - } - - @Override - protected void onNewIntent(Intent intent) { - super.onNewIntent(intent); - provider = intent.getParcelableExtra(PROVIDER_KEY); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == REQUEST_CODE_CONFIGURE_LEAP) { - if (resultCode == RESULT_OK) { - setResult(resultCode, data); - finish(); - } - } - } - - private void onAnonymouslySelected() { - Intent intent; - Log.d(TAG, "use anonymously selected"); - intent = new Intent(); - intent.putExtra(Provider.KEY, provider); - setResult(RESULT_OK, intent); - finish(); - } - -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java deleted file mode 100644 index 193c1d59..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java +++ /dev/null @@ -1,126 +0,0 @@ -package se.leap.bitmaskclient.providersetup.activities; - -import android.content.Intent; -import android.os.Bundle; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.View; -import android.widget.Button; - -import com.google.android.material.textfield.TextInputEditText; -import com.google.android.material.textfield.TextInputLayout; - -import butterknife.BindView; -import se.leap.bitmaskclient.R; - -import static se.leap.bitmaskclient.providersetup.activities.ProviderListBaseActivity.EXTRAS_KEY_INVALID_URL; - -/** - * Created by cyberta on 30.06.18. - */ - -public abstract class AddProviderBaseActivity extends ConfigWizardBaseActivity { - - final public static String EXTRAS_KEY_NEW_URL = "NEW_URL"; - - @BindView(R.id.text_uri_error) - TextInputLayout urlError; - - @BindView(R.id.text_uri) - TextInputEditText editUrl; - - @BindView(R.id.button_cancel) - Button cancelButton; - - @BindView(R.id.button_save) - Button saveButton; - - - protected void init() { - Bundle extras = this.getIntent().getExtras(); - if (extras != null && extras.containsKey(EXTRAS_KEY_INVALID_URL)) { - editUrl.setText(extras.getString(EXTRAS_KEY_INVALID_URL)); - saveButton.setEnabled(true); - } - - setupSaveButton(); - setupCancelButton(); - setUpListeners(); - setUpInitialUI(); - } - - public abstract void setupSaveButton(); - - private void setupCancelButton() { - cancelButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - finish(); - } - }); - } - - private void setUpInitialUI() { - setProviderHeaderText(R.string.add_provider); - hideProgressBar(); - } - - protected void saveProvider() { - String entered_url = getURL(); - if (validURL(entered_url)) { - Intent intent = this.getIntent(); - intent.putExtra(EXTRAS_KEY_NEW_URL, entered_url); - setResult(RESULT_OK, intent); - finish(); - } else { - editUrl.setText(""); - urlError.setError(getString(R.string.not_valid_url_entered)); - } - } - - private void setUpListeners() { - - editUrl.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - @Override - public void afterTextChanged(Editable s) { - if (!validURL(getURL())) { - urlError.setError(getString(R.string.not_valid_url_entered)); - saveButton.setEnabled(false); - - } else { - urlError.setError(null); - saveButton.setEnabled(true); - } - } - }); - } - - private String getURL() { - String entered_url = editUrl.getText().toString().trim(); - if (entered_url.contains("www.")) entered_url = entered_url.replaceFirst("www.", ""); - if (!entered_url.startsWith("https://")) { - if (entered_url.startsWith("http://")) { - entered_url = entered_url.substring("http://".length()); - } - entered_url = "https://".concat(entered_url); - } - return entered_url; - } - - /** - * Checks if the entered url is valid or not. - * - * @param enteredUrl - * @return true if it's not empty nor contains only the protocol. - */ - boolean validURL(String enteredUrl) { - return android.util.Patterns.WEB_URL.matcher(enteredUrl).matches(); - } -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java deleted file mode 100644 index c695cc46..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2020 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package se.leap.bitmaskclient.providersetup.activities; - -import android.view.View; - -import androidx.appcompat.app.AppCompatActivity; - -import butterknife.ButterKnife; - -/** - * Automatically inject with ButterKnife after calling setContentView - */ - -public abstract class ButterKnifeActivity extends AppCompatActivity { - - @Override - public void setContentView(View view) { - super.setContentView(view); - ButterKnife.bind(this); - } - - @Override - public void setContentView(int layoutResID) { - super.setContentView(layoutResID); - ButterKnife.bind(this); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - } -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java deleted file mode 100644 index 1bf66d7d..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java +++ /dev/null @@ -1,430 +0,0 @@ -package se.leap.bitmaskclient.providersetup.activities; - -import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; -import static android.view.View.GONE; -import static android.view.View.VISIBLE; -import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE; -import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.tor.TorStatusObservable.getBootstrapProgress; -import static se.leap.bitmaskclient.tor.TorStatusObservable.getLastLogs; -import static se.leap.bitmaskclient.tor.TorStatusObservable.getLastSnowflakeLog; -import static se.leap.bitmaskclient.tor.TorStatusObservable.getLastTorLog; -import static se.leap.bitmaskclient.tor.TorStatusObservable.getStringForCurrentStatus; - -import android.graphics.Rect; -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.RelativeLayout; - -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.appcompat.widget.AppCompatTextView; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.constraintlayout.widget.Guideline; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import java.util.List; -import java.util.Observable; -import java.util.Observer; - -import butterknife.BindView; -import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.base.models.Provider; -import se.leap.bitmaskclient.base.views.ProviderHeaderView; -import se.leap.bitmaskclient.providersetup.TorLogAdapter; -import se.leap.bitmaskclient.tor.TorStatusObservable; - -/** - * Base Activity for configuration wizard activities - * - * Created by fupduck on 09.01.18. - */ - -public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity implements Observer { - - private static final String TAG = ConfigWizardBaseActivity.class.getName(); - public static final float GUIDE_LINE_COMPACT_DELTA = 0.1f; - - @BindView(R.id.header) - ProviderHeaderView providerHeaderView; - - //Add provider screen has no loading screen - @Nullable - @BindView(R.id.loading_screen) - protected LinearLayout loadingScreen; - - @Nullable - @BindView(R.id.btn_connection_detail) - protected AppCompatTextView connectionDetailBtn; - - @Nullable - @BindView(R.id.connection_detail_header_container) - protected RelativeLayout connectionDetailHeaderContainer; - - @Nullable - @BindView(R.id.connection_details_title) - protected AppCompatTextView connectionDetailsTitle; - - @Nullable - @BindView(R.id.connection_detail_container) - protected RelativeLayout connectionDetailContainer; - - @Nullable - @BindView(R.id.log_container) - protected RelativeLayout logsContainer; - - @Nullable - @BindView(R.id.tor_state) - protected AppCompatTextView torState; - - @Nullable - @BindView(R.id.snowflake_state) - protected AppCompatTextView snowflakeState; - - @Nullable - @BindView(R.id.connection_detail_logs) - protected RecyclerView connectionDetailLogs; - - private TorLogAdapter torLogAdapter; - - @Nullable - @BindView(R.id.progressbar) - protected ProgressBar progressBar; - - @Nullable - @BindView(R.id.progressbar_title) - protected AppCompatTextView progressbarTitle; - - @Nullable - @BindView(R.id.progressbar_description) - protected AppCompatTextView progressbarDescription; - - //Only tablet layouts have guidelines as they are based on a ConstraintLayout - @Nullable - @BindView(R.id.guideline_top) - protected Guideline guideline_top; - - @Nullable - @BindView(R.id.guideline_bottom) - protected Guideline guideline_bottom; - - @BindView(R.id.content) - protected LinearLayout content; - - protected Provider provider; - - protected boolean isCompactLayout = false; - protected boolean isActivityShowing; - - private float defaultGuidelineTopPercentage; - private float defaultGuidelineBottomPercentage; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - provider = getIntent().getParcelableExtra(PROVIDER_KEY); - } - - @Override - public void setContentView(View view) { - super.setContentView(view); - initContentView(); - } - - @Override - public void setContentView(int layoutResID) { - super.setContentView(layoutResID); - initContentView(); - } - - @Override - public void setContentView(View view, ViewGroup.LayoutParams params) { - super.setContentView(view, params); - initContentView(); - } - - private void initContentView() { - if (provider != null) { - setProviderHeaderText(provider.getName()); - } - setDefaultGuidelineValues(); - setGlobalLayoutChangeListener(); - } - - private void setDefaultGuidelineValues() { - if (isTabletLayout()) { - defaultGuidelineTopPercentage = ((ConstraintLayout.LayoutParams) guideline_top.getLayoutParams()).guidePercent; - defaultGuidelineBottomPercentage = ((ConstraintLayout.LayoutParams) guideline_bottom.getLayoutParams()).guidePercent; - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - if (provider != null) { - outState.putParcelable(PROVIDER_KEY, provider); - } - } - - @Override - protected void onPause() { - super.onPause(); - isActivityShowing = false; - TorStatusObservable.getInstance().deleteObserver(this); - } - - @Override - protected void onResume() { - super.onResume(); - isActivityShowing = true; - TorStatusObservable.getInstance().addObserver(this); - setProgressbarDescription(getStringForCurrentStatus(this)); - } - - protected void restoreState(Bundle savedInstanceState) { - if (savedInstanceState != null && savedInstanceState.containsKey(PROVIDER_KEY)) { - provider = savedInstanceState.getParcelable(PROVIDER_KEY); - } - } - - protected void setProviderHeaderLogo(@DrawableRes int providerHeaderLogo) { - providerHeaderView.setLogo(providerHeaderLogo); - } - - protected void setProviderHeaderText(String providerHeaderText) { - providerHeaderView.setTitle(providerHeaderText); - } - - protected void setProviderHeaderText(@StringRes int providerHeaderText) { - providerHeaderView.setTitle(providerHeaderText); - } - - protected void hideConnectionDetails() { - if (loadingScreen == null) { - return; - } - if (connectionDetailContainer.getVisibility() == VISIBLE) { - connectionDetailBtn.setText(R.string.show_connection_details); - } - connectionDetailHeaderContainer.setVisibility(GONE); - connectionDetailContainer.setVisibility(GONE); - logsContainer.setVisibility(GONE); - } - - protected void showConnectionDetails() { - if (loadingScreen == null) { - return; - } - LinearLayoutManager layoutManager = new LinearLayoutManager(this); - connectionDetailLogs.setLayoutManager(layoutManager); - torLogAdapter = new TorLogAdapter(getLastLogs()); - connectionDetailLogs.setAdapter(torLogAdapter); - - connectionDetailLogs.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (newState != SCROLL_STATE_IDLE) { - torLogAdapter.postponeUpdate = true; - } else if (newState == SCROLL_STATE_IDLE && getFirstVisibleItemPosion() == 0) { - torLogAdapter.postponeUpdate = false; - } - } - }); - - snowflakeState.setText(getLastSnowflakeLog()); - torState.setText(getLastTorLog()); - connectionDetailBtn.setOnClickListener(v -> { - if (logsContainer.getVisibility() == VISIBLE) { - logsContainer.setVisibility(GONE); - connectionDetailContainer.setVisibility(GONE); - connectionDetailsTitle.setVisibility(GONE); - connectionDetailBtn.setText(R.string.show_connection_details); - } else { - logsContainer.setVisibility(VISIBLE); - connectionDetailContainer.setVisibility(VISIBLE); - connectionDetailsTitle.setVisibility(VISIBLE); - connectionDetailBtn.setText(R.string.hide); - } - }); - connectionDetailHeaderContainer.setVisibility(VISIBLE); - } - - private int getFirstVisibleItemPosion() { - return ((LinearLayoutManager)connectionDetailLogs.getLayoutManager()).findFirstVisibleItemPosition(); - } - - protected void hideProgressBar() { - if (loadingScreen == null) { - return; - } - hideConnectionDetails(); - loadingScreen.setVisibility(GONE); - content.setVisibility(VISIBLE); - } - - protected void showProgressBar() { - if (loadingScreen == null) { - return; - } - content.setVisibility(GONE); - loadingScreen.setVisibility(VISIBLE); - } - - protected void setProgressbarTitle(@StringRes int progressbarTitle) { - if (loadingScreen == null) { - return; - } - this.progressbarTitle.setText(progressbarTitle); - } - - protected void setProgressbarDescription(String progressbarDescription) { - if (loadingScreen == null) { - return; - } - this.progressbarDescription.setText(progressbarDescription); - } - - protected void setConfigProgress(int value) { - if (loadingScreen == null) { - return; - } - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { - progressBar.setProgress(value); - } else { - progressBar.setProgress(value, true); - } - progressBar.setIndeterminate(value >= 100 || value < 0); - } - - - protected void showCompactLayout() { - if (isCompactLayout) { - return; - } - - if (isTabletLayoutInLandscape() || isPhoneLayout()) { - providerHeaderView.showCompactLayout(); - } - - showIncreasedTabletContentArea(); - isCompactLayout = true; - } - - protected void showStandardLayout() { - if (!isCompactLayout) { - return; - } - providerHeaderView.showStandardLayout(); - showStandardTabletContentArea(); - isCompactLayout = false; - } - - private boolean isTabletLayoutInLandscape() { - // TabletLayout is based on a ConstraintLayout and uses Guidelines whereas the phone layout - // has no such elements in it's layout xml file - return guideline_top != null && - guideline_bottom != null && - getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE; - } - - protected boolean isPhoneLayout() { - return guideline_top == null && guideline_bottom == null; - } - - protected boolean isTabletLayout() { - return guideline_top != null && guideline_bottom != null; - } - - /** - * Increases the white content area in tablet layouts - */ - private void showIncreasedTabletContentArea() { - if (isPhoneLayout()) { - return; - } - ConstraintLayout.LayoutParams guideLineTopParams = (ConstraintLayout.LayoutParams) guideline_top.getLayoutParams(); - float increasedTopPercentage = defaultGuidelineTopPercentage - GUIDE_LINE_COMPACT_DELTA; - guideLineTopParams.guidePercent = increasedTopPercentage > 0f ? increasedTopPercentage : 0f; - guideline_top.setLayoutParams(guideLineTopParams); - - ConstraintLayout.LayoutParams guideLineBottomParams = (ConstraintLayout.LayoutParams) guideline_bottom.getLayoutParams(); - float increasedBottomPercentage = defaultGuidelineBottomPercentage + GUIDE_LINE_COMPACT_DELTA; - guideLineBottomParams.guidePercent = increasedBottomPercentage < 1f ? increasedBottomPercentage : 1f; - guideline_bottom.setLayoutParams(guideLineBottomParams); - } - - /** - * Restores the default size of the white content area in tablet layouts - */ - private void showStandardTabletContentArea() { - if (isPhoneLayout()) { - return; - } - ConstraintLayout.LayoutParams guideLineTopParams = (ConstraintLayout.LayoutParams) guideline_top.getLayoutParams(); - guideLineTopParams.guidePercent = defaultGuidelineTopPercentage; - guideline_top.setLayoutParams(guideLineTopParams); - - ConstraintLayout.LayoutParams guideLineBottomParams = (ConstraintLayout.LayoutParams) guideline_bottom.getLayoutParams(); - guideLineBottomParams.guidePercent = defaultGuidelineBottomPercentage; - guideline_bottom.setLayoutParams(guideLineBottomParams); - } - - /** - * Checks if the keyboard is shown and switches between the standard layout and the compact layout - */ - private void setGlobalLayoutChangeListener() { - final View rootView = content.getRootView(); - rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - Rect r = new Rect(); - //r will be populated with the coordinates of your view that area still visible. - rootView.getWindowVisibleDisplayFrame(r); - - float deltaHiddenScreen = 1f - ((float) (r.bottom - r.top) / (float) rootView.getHeight()); - if (deltaHiddenScreen > 0.25f) { - // if more than 1/4 of the screen is hidden - showCompactLayout(); - } else { - showStandardLayout(); - } - } - }); - } - - @Override - public void update(Observable o, Object arg) { - if (o instanceof TorStatusObservable) { - runOnUiThread(() -> { - if (TorStatusObservable.getStatus() != TorStatusObservable.TorStatus.OFF && loadingScreen != null) { - if (connectionDetailContainer.getVisibility() == GONE) { - showConnectionDetails(); - } else { - setLogs(getLastTorLog(), getLastSnowflakeLog(), getLastLogs()); - } - } - setProgressbarDescription(getStringForCurrentStatus(ConfigWizardBaseActivity.this)); - setConfigProgress(getBootstrapProgress()); - }); - } - } - - protected void setLogs(String torLog, String snowflakeLog, List<String> lastLogs) { - if (loadingScreen == null) { - return; - } - torLogAdapter.updateData(lastLogs); - torState.setText(torLog); - snowflakeState.setText(snowflakeLog); - } - -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/CustomProviderSetupActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/CustomProviderSetupActivity.java deleted file mode 100644 index 520395f8..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/CustomProviderSetupActivity.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (c) 2018 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package se.leap.bitmaskclient.providersetup.activities; - -import android.content.Intent; -import android.content.res.AssetManager; -import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.IOException; - -import se.leap.bitmaskclient.BuildConfig; -import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.base.models.Provider; -import se.leap.bitmaskclient.base.utils.ConfigHelper; -import se.leap.bitmaskclient.providersetup.ProviderAPICommand; - -import static se.leap.bitmaskclient.BuildConfig.customProviderApiIp; -import static se.leap.bitmaskclient.BuildConfig.customProviderIp; -import static se.leap.bitmaskclient.BuildConfig.customProviderMotdUrl; -import static se.leap.bitmaskclient.BuildConfig.customProviderUrl; -import static se.leap.bitmaskclient.BuildConfig.geoipUrl; -import static se.leap.bitmaskclient.base.models.Constants.EXT_JSON; -import static se.leap.bitmaskclient.base.models.Constants.EXT_PEM; -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.base.utils.ConfigHelper.preferAnonymousUsage; -import static se.leap.bitmaskclient.base.utils.InputStreamHelper.loadInputStreamAsString; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.SET_UP_PROVIDER; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; - -/** - * Created by cyberta on 17.08.18. - */ - -public class CustomProviderSetupActivity extends ProviderSetupBaseActivity { - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setUpInitialUI(); - restoreState(savedInstanceState); - setDefaultProvider(); - } - - @Override - protected void onResume() { - super.onResume(); - if (getConfigState() == ProviderConfigState.PROVIDER_NOT_SET) { - showProgressBar(); - setupProvider(); - } - } - - private void setDefaultProvider() { - try { - AssetManager assetsManager = getAssets(); - Provider customProvider = new Provider(customProviderUrl, geoipUrl, customProviderMotdUrl, customProviderIp, customProviderApiIp); - String domain = ConfigHelper.getDomainFromMainURL(customProviderUrl); - String certificate = loadInputStreamAsString(assetsManager.open(domain + EXT_PEM)); - String providerDefinition = loadInputStreamAsString(assetsManager.open(domain + EXT_JSON)); - customProvider.setCaCert(certificate); - customProvider.define(new JSONObject(providerDefinition)); - setProvider(customProvider); - } catch (IOException | JSONException e) { - e.printStackTrace(); - setProvider(new Provider(customProviderUrl, geoipUrl, customProviderMotdUrl, customProviderIp, customProviderApiIp)); - } - } - - private void setUpInitialUI() { - setContentView(R.layout.a_custom_provider_setup); - setProviderHeaderText(R.string.setup_provider); - hideProgressBar(); - } - - private void setupProvider() { - setProviderConfigState(SETTING_UP_PROVIDER); - ProviderAPICommand.execute(this, SET_UP_PROVIDER, getProvider()); - } - - // ------- ProviderSetupInterface ---v - @Override - public void handleProviderSetUp(Provider provider) { - setProvider(provider); - if (provider.allowsAnonymous()) { - downloadVpnCertificate(); - } else { - showProviderDetails(); - } - } - - @Override - public void handleCorrectlyDownloadedCertificate(Provider provider) { - if (preferAnonymousUsage()) { - finishWithSetupWithProvider(provider); - } else { - this.provider = provider; - showProviderDetails(); - } - } - - // ------- DownloadFailedDialogInterface ---v - @Override - public void retrySetUpProvider(@NonNull Provider provider) { - setupProvider(); - showProgressBar(); - } - - @Override - public void cancelSettingUpProvider() { - super.cancelSettingUpProvider(); - finish(); - } - - @Override - public void addAndSelectNewProvider(String url) { - // ignore - } - - private void finishWithSetupWithProvider(Provider provider) { - Intent intent = new Intent(); - intent.putExtra(Provider.KEY, provider); - setResult(RESULT_OK, intent); - finish(); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == REQUEST_CODE_CONFIGURE_LEAP) { - setResult(resultCode, data); - finish(); - } - } -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/LoginActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/LoginActivity.java deleted file mode 100644 index 9a5f31f2..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/LoginActivity.java +++ /dev/null @@ -1,32 +0,0 @@ -package se.leap.bitmaskclient.providersetup.activities; - -import android.os.Bundle; -import androidx.annotation.Nullable; - -import butterknife.OnClick; -import se.leap.bitmaskclient.R; - -/** - * Activity to login to chosen Provider - * - * Created by fupduck on 09.01.18. - */ - -public class LoginActivity extends ProviderCredentialsBaseActivity { - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setProgressbarTitle(R.string.logging_in); - setProviderHeaderLogo(R.drawable.logo); - setProviderHeaderText(R.string.login_to_profile); - } - - @Override - @OnClick(R.id.button) - void handleButton() { - super.handleButton(); - login(getUsername(), getPassword()); - } - -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java deleted file mode 100644 index e186ce5d..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java +++ /dev/null @@ -1,479 +0,0 @@ -/** - * Copyright (c) 2018 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package se.leap.bitmaskclient.providersetup.activities; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Build; -import android.os.Build.VERSION_CODES; -import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import com.google.android.material.textfield.TextInputEditText; -import com.google.android.material.textfield.TextInputLayout; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import androidx.appcompat.widget.AppCompatButton; -import androidx.appcompat.widget.AppCompatTextView; -import android.text.Editable; -import android.text.Html; -import android.text.TextWatcher; -import android.text.method.LinkMovementMethod; -import android.text.util.Linkify; -import android.util.Log; -import android.view.KeyEvent; -import android.view.inputmethod.InputMethodManager; -import android.widget.TextView; - -import org.json.JSONArray; -import org.json.JSONException; - -import butterknife.BindView; -import butterknife.OnClick; -import se.leap.bitmaskclient.base.models.Constants.CREDENTIAL_ERRORS; -import se.leap.bitmaskclient.base.models.Provider; -import se.leap.bitmaskclient.providersetup.ProviderAPI; -import se.leap.bitmaskclient.providersetup.ProviderAPICommand; -import se.leap.bitmaskclient.R; - -import static android.text.TextUtils.isEmpty; -import static android.view.View.GONE; -import static android.view.View.VISIBLE; -import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; -import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_PROVIDER_API_EVENT; -import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; -import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; -import static se.leap.bitmaskclient.base.models.Constants.CREDENTIALS_PASSWORD; -import static se.leap.bitmaskclient.base.models.Constants.CREDENTIALS_USERNAME; -import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.LOG_IN; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.SIGN_UP; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; - -/** - * Base Activity for activities concerning a provider interaction - * - * Created by fupduck on 09.01.18. - */ - -public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseActivity { - - final protected static String TAG = ProviderCredentialsBaseActivity.class.getName(); - - final private static String ACTIVITY_STATE = "ACTIVITY STATE"; - - final private static String SHOWING_FORM = "SHOWING_FORM"; - final private static String PERFORMING_ACTION = "PERFORMING_ACTION"; - final private static String USERNAME_ERROR = "USERNAME_ERROR"; - final private static String PASSWORD_ERROR = "PASSWORD_ERROR"; - final private static String PASSWORD_VERIFICATION_ERROR = "PASSWORD_VERIFICATION_ERROR"; - - protected Intent mConfigState = new Intent(SHOWING_FORM); - protected ProviderAPIBroadcastReceiver providerAPIBroadcastReceiver; - - @BindView(R.id.provider_credentials_user_message) - AppCompatTextView userMessage; - - @BindView(R.id.provider_credentials_username) - TextInputEditText usernameField; - - @BindView(R.id.provider_credentials_password) - TextInputEditText passwordField; - - @BindView(R.id.provider_credentials_password_verification) - TextInputEditText passwordVerificationField; - - @BindView(R.id.provider_credentials_username_error) - TextInputLayout usernameError; - - @BindView(R.id.provider_credentials_password_error) - TextInputLayout passwordError; - - @BindView(R.id.provider_credentials_password_verification_error) - TextInputLayout passwordVerificationError; - - @BindView(R.id.button) - AppCompatButton button; - - private boolean isUsernameError = false; - private boolean isPasswordError = false; - private boolean isVerificationError = false; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.a_provider_credentials); - providerAPIBroadcastReceiver = new ProviderAPIBroadcastReceiver(); - - IntentFilter updateIntentFilter = new IntentFilter(BROADCAST_PROVIDER_API_EVENT); - updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT); - LocalBroadcastManager.getInstance(this).registerReceiver(providerAPIBroadcastReceiver, updateIntentFilter); - - setUpListeners(); - restoreState(savedInstanceState); - - String userMessageString = getIntent().getStringExtra(USER_MESSAGE); - if (userMessageString != null) { - userMessage.setText(userMessageString); - userMessage.setVisibility(VISIBLE); - } - } - - @Override - protected void onResume() { - super.onResume(); - - String action = mConfigState.getAction(); - if (action == null) { - return; - } - - if(action.equalsIgnoreCase(PERFORMING_ACTION)) { - showProgressBar(); - } - } - - protected void restoreState(Bundle savedInstance) { - super.restoreState(savedInstance); - if (savedInstance == null) { - return; - } - if (savedInstance.getString(USER_MESSAGE) != null) { - userMessage.setText(savedInstance.getString(USER_MESSAGE)); - userMessage.setVisibility(VISIBLE); - } - updateUsernameError(savedInstance.getString(USERNAME_ERROR)); - updatePasswordError(savedInstance.getString(PASSWORD_ERROR)); - updateVerificationError(savedInstance.getString(PASSWORD_VERIFICATION_ERROR)); - if (savedInstance.getString(ACTIVITY_STATE) != null) { - mConfigState.setAction(savedInstance.getString(ACTIVITY_STATE)); - } - } - - private void updateUsernameError(String usernameErrorString) { - usernameError.setError(usernameErrorString); - isUsernameError = usernameErrorString != null; - updateButton(); - } - - private void updatePasswordError(String passwordErrorString) { - passwordError.setError(passwordErrorString); - isPasswordError = passwordErrorString != null; - updateButton(); - } - - private void updateVerificationError(String verificationErrorString) { - passwordVerificationError.setError(verificationErrorString); - isVerificationError = verificationErrorString != null; - updateButton(); - } - - private void updateButton() { - button.setEnabled(!isPasswordError && - !isUsernameError && - !isVerificationError && - !isEmpty(passwordField.getText()) && - !isEmpty(usernameField.getText()) && - !(passwordVerificationField.getVisibility() == VISIBLE && - getPasswordVerification().length() == 0)); - } - - @Override - public void onSaveInstanceState(Bundle outState) { - outState.putString(ACTIVITY_STATE, mConfigState.getAction()); - if (userMessage.getText() != null && userMessage.getVisibility() == VISIBLE) { - outState.putString(USER_MESSAGE, userMessage.getText().toString()); - } - if (usernameError.getError() != null) { - outState.putString(USERNAME_ERROR, usernameError.getError().toString()); - } - if (passwordError.getError() != null) { - outState.putString(PASSWORD_ERROR, passwordError.getError().toString()); - } - if (passwordVerificationError.getError() != null) { - outState.putString(PASSWORD_VERIFICATION_ERROR, passwordVerificationError.getError().toString()); - } - - super.onSaveInstanceState(outState); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - if (providerAPIBroadcastReceiver != null) - LocalBroadcastManager.getInstance(this).unregisterReceiver(providerAPIBroadcastReceiver); - } - - @OnClick(R.id.button) - void handleButton() { - mConfigState.setAction(PERFORMING_ACTION); - hideKeyboard(); - showProgressBar(); - } - - protected void setButtonText(@StringRes int buttonText) { - button.setText(buttonText); - } - - String getUsername() { - String username = usernameField.getText().toString(); - String providerDomain = provider.getDomain(); - if (username.endsWith(providerDomain)) { - try { - return username.split("@" + providerDomain)[0]; - } catch (ArrayIndexOutOfBoundsException e) { - return ""; - } - } - return username; - } - - String getPassword() { - return passwordField.getText().toString(); - } - - String getPasswordVerification() { - return passwordVerificationField.getText().toString(); - } - - void login(String username, String password) { - - Bundle parameters = bundleUsernameAndPassword(username, password); - ProviderAPICommand.execute(this, LOG_IN, parameters, provider); - } - - public void signUp(String username, String password) { - - Bundle parameters = bundleUsernameAndPassword(username, password); - ProviderAPICommand.execute(this, SIGN_UP, parameters, provider); - } - - void downloadVpnCertificate(Provider handledProvider) { - provider = handledProvider; - ProviderAPICommand.execute(this, DOWNLOAD_VPN_CERTIFICATE, provider); - } - - protected Bundle bundleUsernameAndPassword(String username, String password) { - Bundle parameters = new Bundle(); - if (!username.isEmpty()) - parameters.putString(CREDENTIALS_USERNAME, username); - if (!password.isEmpty()) - parameters.putString(CREDENTIALS_PASSWORD, password); - return parameters; - } - - private void setUpListeners() { - usernameField.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - @Override - public void afterTextChanged(Editable s) { - if (getUsername().equalsIgnoreCase("")) { - s.clear(); - updateUsernameError(getString(R.string.username_ask)); - } else { - updateUsernameError(null); - String suffix = "@" + provider.getDomain(); - if (!usernameField.getText().toString().endsWith(suffix)) { - s.append(suffix); - usernameField.setSelection(usernameField.getText().toString().indexOf('@')); - } - } - } - }); - usernameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { - @Override - public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { - if (actionId == IME_ACTION_DONE - || event != null && event.getAction() == KeyEvent.ACTION_DOWN - && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { - passwordField.requestFocus(); - return true; - } - return false; - } - }); - - passwordField.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - @Override - public void afterTextChanged(Editable s) { - if(getPassword().length() < 8) { - updatePasswordError(getString(R.string.error_not_valid_password_user_message)); - } else { - updatePasswordError(null); - } - } - }); - passwordField.setOnEditorActionListener(new TextView.OnEditorActionListener() { - @Override - public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { - if (actionId == IME_ACTION_DONE - || event != null && event.getAction() == KeyEvent.ACTION_DOWN - && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { - if (passwordVerificationField.getVisibility() == VISIBLE) { - passwordVerificationField.requestFocus(); - } else { - button.performClick(); - } - return true; - } - return false; - } - }); - - passwordVerificationField.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - @Override - public void afterTextChanged(Editable s) { - if(getPassword().equals(getPasswordVerification())) { - updateVerificationError(null); - } else { - updateVerificationError(getString(R.string.password_mismatch)); - } - } - }); - passwordVerificationField.setOnEditorActionListener(new TextView.OnEditorActionListener() { - @Override - public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { - if (actionId == IME_ACTION_DONE - || event != null && event.getAction() == KeyEvent.ACTION_DOWN - && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { - button.performClick(); - return true; - } - return false; - } - }); - } - - private void hideKeyboard() { - InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); - if (imm != null) { - imm.hideSoftInputFromWindow(passwordField.getWindowToken(), 0); - } - } - - private void handleReceivedErrors(Bundle arguments) { - if (arguments.containsKey(CREDENTIAL_ERRORS.PASSWORD_INVALID_LENGTH.toString())) { - updatePasswordError(getString(R.string.error_not_valid_password_user_message)); - } else if (arguments.containsKey(CREDENTIAL_ERRORS.RISEUP_WARNING.toString())) { - userMessage.setVisibility(VISIBLE); - userMessage.setText(R.string.login_riseup_warning); - } - if (arguments.containsKey(CREDENTIALS_USERNAME)) { - String username = arguments.getString(CREDENTIALS_USERNAME); - usernameField.setText(username); - } - if (arguments.containsKey(CREDENTIAL_ERRORS.USERNAME_MISSING.toString())) { - updateUsernameError(getString(R.string.username_ask)); - } - if (arguments.containsKey(USER_MESSAGE)) { - String userMessageString = arguments.getString(USER_MESSAGE); - try { - userMessageString = new JSONArray(userMessageString).getString(0); - } catch (JSONException e) { - e.printStackTrace(); - } - - if (Build.VERSION.SDK_INT >= VERSION_CODES.N) { - userMessage.setText(Html.fromHtml(userMessageString, Html.FROM_HTML_MODE_LEGACY)); - } else { - userMessage.setText(Html.fromHtml(userMessageString)); - } - Linkify.addLinks(userMessage, Linkify.ALL); - userMessage.setMovementMethod(LinkMovementMethod.getInstance()); - userMessage.setVisibility(VISIBLE); - } else if (userMessage.getVisibility() != GONE) { - userMessage.setVisibility(GONE); - } - - if (!usernameField.getText().toString().isEmpty() && passwordField.isFocusable()) - passwordField.requestFocus(); - - mConfigState.setAction(SHOWING_FORM); - hideProgressBar(); - } - - private void successfullyFinished(Provider handledProvider) { - provider = handledProvider; - Intent resultData = new Intent(); - resultData.putExtra(Provider.KEY, provider); - setResult(RESULT_OK, resultData); - finish(); - } - - //TODO: replace with EipSetupObserver - public class ProviderAPIBroadcastReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - Log.d(TAG, "received Broadcast"); - - String action = intent.getAction(); - if (action == null || !action.equalsIgnoreCase(BROADCAST_PROVIDER_API_EVENT)) { - return; - } - - int resultCode = intent.getIntExtra(BROADCAST_RESULT_CODE, RESULT_CANCELED); - Bundle resultData = intent.getParcelableExtra(BROADCAST_RESULT_KEY); - Provider handledProvider = resultData.getParcelable(PROVIDER_KEY); - - switch (resultCode) { - case ProviderAPI.SUCCESSFUL_SIGNUP: - String password = resultData.getString(CREDENTIALS_PASSWORD); - String username = resultData.getString(CREDENTIALS_USERNAME); - login(username, password); - break; - case ProviderAPI.SUCCESSFUL_LOGIN: - downloadVpnCertificate(handledProvider); - break; - case ProviderAPI.FAILED_LOGIN: - case ProviderAPI.FAILED_SIGNUP: - handleReceivedErrors((Bundle) intent.getParcelableExtra(BROADCAST_RESULT_KEY)); - break; - - case ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE: - // error handling takes place in MainActivity - case ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE: - successfullyFinished(handledProvider); - break; - } - } - } -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java deleted file mode 100644 index eb9898b8..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Copyright (c) 2017 LEAP Encryption Access Project and contributors - * <p> - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * <p> - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * <p> - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package se.leap.bitmaskclient.providersetup.activities; - -import android.content.Intent; -import android.os.Bundle; -import android.widget.ListView; - -import androidx.annotation.NonNull; - -import com.pedrogomez.renderers.Renderer; - -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Inject; - -import butterknife.BindView; -import butterknife.OnItemClick; -import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.base.models.Provider; -import se.leap.bitmaskclient.providersetup.AddProviderActivity; -import se.leap.bitmaskclient.providersetup.ProviderListActivity; -import se.leap.bitmaskclient.providersetup.ProviderListAdapter; -import se.leap.bitmaskclient.providersetup.ProviderRenderer; -import se.leap.bitmaskclient.providersetup.ProviderRendererBuilder; - -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_ADD_PROVIDER; -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SHOW_FAILED_DIALOG; - -/** - * abstract base Activity that builds and shows the list of known available providers. - * The implementation of ProviderListBaseActivity differ in that they may or may not allow to bypass - * secure download mechanisms including certificate validation. - * <p/> - * It also allows the user to enter custom providers with a button. - * - * @author parmegv - * @author cyberta - */ - -public abstract class ProviderListBaseActivity extends ProviderSetupBaseActivity { - - @BindView(R.id.provider_list) - protected ListView providerListView; - @Inject - protected ProviderListAdapter adapter; - - final public static String TAG = ProviderListActivity.class.getSimpleName(); - final protected static String EXTRAS_KEY_INVALID_URL = "INVALID_URL"; - - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setUpInitialUI(); - initProviderList(); - restoreState(savedInstanceState); - } - - public abstract void retrySetUpProvider(@NonNull Provider provider); - - protected abstract void onItemSelectedLogic(); - - private void initProviderList() { - List<Renderer<Provider>> prototypes = new ArrayList<>(); - prototypes.add(new ProviderRenderer(this)); - ProviderRendererBuilder providerRendererBuilder = new ProviderRendererBuilder(prototypes); - adapter = new ProviderListAdapter(getLayoutInflater(), providerRendererBuilder, getProviderManager()); - providerListView.setAdapter(adapter); - } - - private void setUpInitialUI() { - setContentView(R.layout.a_provider_list); - setProviderHeaderText(R.string.setup_provider); - hideProgressBar(); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == REQUEST_CODE_CONFIGURE_LEAP) { - if (resultCode == RESULT_OK) { - setResult(resultCode, data); - finish(); - } - } else if (requestCode == REQUEST_CODE_ADD_PROVIDER) { - if (resultCode == RESULT_OK) { - testNewURL = true; - String newUrl = data.getStringExtra(AddProviderActivity.EXTRAS_KEY_NEW_URL); - this.provider.setMainUrl(newUrl); - showAndSelectProvider(newUrl); - } else { - cancelSettingUpProvider(); - } - } - } - - public void showAndSelectProvider(String newURL) { - provider = new Provider(newURL); - autoSelectProvider(); - } - - private void autoSelectProvider() { - onItemSelectedLogic(); - showProgressBar(); - } - - // ------- ProviderSetupInterface ---v - @Override - public void handleProviderSetUp(Provider handledProvider) { - this.provider = handledProvider; - adapter.add(provider); - adapter.saveProviders(); - if (provider.allowsAnonymous()) { - //FIXME: providerApiBroadcastReceiver.getConfigState().putExtra(SERVICES_RETRIEVED, true); DEAD CODE??? - downloadVpnCertificate(); - } else { - showProviderDetails(); - } - } - - @Override - public void handleCorrectlyDownloadedCertificate(Provider handledProvider) { - this.provider = handledProvider; - showProviderDetails(); - } - - @OnItemClick(R.id.provider_list) - void onItemSelected(int position) { - if (SETTING_UP_PROVIDER == getConfigState() || - SHOW_FAILED_DIALOG == getConfigState()) { - return; - } - - //TODO Code 2 pane view - provider = adapter.getItem(position); - if (provider != null && !provider.isDefault()) { - //TODO Code 2 pane view - providerConfigState = SETTING_UP_PROVIDER; - showProgressBar(); - onItemSelectedLogic(); - } else { - addAndSelectNewProvider(); - } - } - - @Override - public void onBackPressed() { - if (SETTING_UP_PROVIDER == providerConfigState || - SHOW_FAILED_DIALOG == providerConfigState) { - cancelSettingUpProvider(); - } else { - super.onBackPressed(); - } - } - - /** - * Open the new provider dialog - */ - public void addAndSelectNewProvider() { - Intent intent = new Intent(this, AddProviderActivity.class); - startActivityForResult(intent, REQUEST_CODE_ADD_PROVIDER); - } - - /** - * Open the new provider dialog - */ - @Override - public void addAndSelectNewProvider(String url) { - testNewURL = false; - Intent intent = new Intent(this, AddProviderActivity.class); - intent.putExtra(EXTRAS_KEY_INVALID_URL, url); - startActivityForResult(intent, REQUEST_CODE_ADD_PROVIDER); - } - -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java deleted file mode 100644 index e429f776..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java +++ /dev/null @@ -1,256 +0,0 @@ -/** - * Copyright (c) 2018 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package se.leap.bitmaskclient.providersetup.activities; - -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Bundle; -import android.util.Log; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.DialogFragment; -import androidx.fragment.app.FragmentTransaction; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import org.json.JSONException; -import org.json.JSONObject; -import org.torproject.jni.TorService; - -import se.leap.bitmaskclient.base.FragmentManagerEnhanced; -import se.leap.bitmaskclient.base.models.Provider; -import se.leap.bitmaskclient.providersetup.ProviderAPICommand; -import se.leap.bitmaskclient.providersetup.ProviderApiSetupBroadcastReceiver; -import se.leap.bitmaskclient.providersetup.ProviderDetailActivity; -import se.leap.bitmaskclient.providersetup.ProviderManager; -import se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog; -import se.leap.bitmaskclient.providersetup.ProviderSetupInterface; -import se.leap.bitmaskclient.tor.TorServiceCommand; -import se.leap.bitmaskclient.tor.TorStatusObservable; - -import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_PROVIDER_API_EVENT; -import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS; -import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_PROVIDER_DETAILS; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.PENDING_SHOW_FAILED_DIALOG; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.PENDING_SHOW_PROVIDER_DETAILS; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.PROVIDER_NOT_SET; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SHOWING_PROVIDER_DETAILS; -import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SHOW_FAILED_DIALOG; -import static se.leap.bitmaskclient.tor.TorStatusObservable.TorStatus.OFF; - -/** - * Created by cyberta on 19.08.18. - */ - -public abstract class ProviderSetupBaseActivity extends ConfigWizardBaseActivity implements ProviderSetupInterface, ProviderSetupFailedDialog.DownloadFailedDialogInterface { - final public static String TAG = "ProviderSetupActivity"; - final private static String ACTIVITY_STATE = "ACTIVITY STATE"; - final private static String REASON_TO_FAIL = "REASON TO FAIL"; - - protected ProviderSetupInterface.ProviderConfigState providerConfigState = PROVIDER_NOT_SET; - private ProviderManager providerManager; - private FragmentManagerEnhanced fragmentManager; - - private String reasonToFail; - protected boolean testNewURL; - - private ProviderApiSetupBroadcastReceiver providerAPIBroadcastReceiver; - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - fragmentManager = new FragmentManagerEnhanced(getSupportFragmentManager()); - providerManager = ProviderManager.getInstance(getAssets(), getExternalFilesDir(null)); - setUpProviderAPIResultReceiver(); - } - - @Override - protected void onResume() { - super.onResume(); - Log.d(TAG, "resuming with ConfigState: " + providerConfigState.toString()); - if (SETTING_UP_PROVIDER == providerConfigState) { - showProgressBar(); - } else if (PENDING_SHOW_FAILED_DIALOG == providerConfigState) { - showProgressBar(); - hideConnectionDetails(); - showDownloadFailedDialog(); - } else if (SHOW_FAILED_DIALOG == providerConfigState) { - showProgressBar(); - hideConnectionDetails(); - } else if (SHOWING_PROVIDER_DETAILS == providerConfigState) { - cancelSettingUpProvider(false); - } else if (PENDING_SHOW_PROVIDER_DETAILS == providerConfigState) { - showProviderDetails(); - } - } - - @Override - protected void onDestroy() { - super.onDestroy(); - if (providerAPIBroadcastReceiver != null) { - LocalBroadcastManager.getInstance(this).unregisterReceiver(providerAPIBroadcastReceiver); - } - providerAPIBroadcastReceiver = null; - } - - - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - outState.putString(ACTIVITY_STATE, providerConfigState.toString()); - outState.putString(REASON_TO_FAIL, reasonToFail); - - super.onSaveInstanceState(outState); - } - - protected FragmentManagerEnhanced getFragmentManagerEnhanced() { - return fragmentManager; - } - - protected ProviderManager getProviderManager() { - return providerManager; - } - - protected void setProviderConfigState(ProviderConfigState state) { - this.providerConfigState = state; - } - - protected void setProvider(Provider provider) { - this.provider = provider; - } - - // --------- ProviderSetupInterface ---v - @Override - public Provider getProvider() { - return provider; - } - - @Override - public ProviderConfigState getConfigState() { - return providerConfigState; - } - - @Override - public void handleError(Bundle resultData) { - reasonToFail = resultData.getString(ERRORS); - showDownloadFailedDialog(); - } - - @Override - public void handleIncorrectlyDownloadedCertificate() { - cancelSettingUpProvider(); - setResult(RESULT_CANCELED, new Intent(getConfigState().toString())); - } - - // -------- DownloadFailedDialogInterface ---v - @Override - public void cancelSettingUpProvider() { - cancelSettingUpProvider(true); - } - - @Override - public void updateProviderDetails() { - providerConfigState = SETTING_UP_PROVIDER; - ProviderAPICommand.execute(this, UPDATE_PROVIDER_DETAILS, provider); - } - - public void cancelSettingUpProvider(boolean stopTor) { - if (stopTor && TorStatusObservable.getStatus() != OFF) { - Log.d(TAG, "SHUTDOWN - cancelSettingUpProvider stopTor:" + stopTor); - TorServiceCommand.stopTorServiceAsync(this); - } - providerConfigState = PROVIDER_NOT_SET; - provider = null; - hideProgressBar(); - } - - protected void restoreState(Bundle savedInstanceState) { - super.restoreState(savedInstanceState); - if (savedInstanceState == null) { - return; - } - this.providerConfigState = ProviderSetupInterface.ProviderConfigState.valueOf(savedInstanceState.getString(ACTIVITY_STATE, PROVIDER_NOT_SET.toString())); - if (savedInstanceState.containsKey(REASON_TO_FAIL)) { - reasonToFail = savedInstanceState.getString(REASON_TO_FAIL); - } - } - - private void setUpProviderAPIResultReceiver() { - providerAPIBroadcastReceiver = new ProviderApiSetupBroadcastReceiver(this); - - IntentFilter updateIntentFilter = new IntentFilter(BROADCAST_PROVIDER_API_EVENT); - updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT); - LocalBroadcastManager.getInstance(this).registerReceiver(providerAPIBroadcastReceiver, updateIntentFilter); - } - - /** - * Asks ProviderApiService to download an anonymous (anon) VPN certificate. - */ - protected void downloadVpnCertificate() { - ProviderAPICommand.execute(this, DOWNLOAD_VPN_CERTIFICATE, provider); - } - - /** - * Once selected a provider, this fragment offers the user to log in, - * use it anonymously (if possible) - * or cancel their selection pressing the back button. - */ - public void showProviderDetails() { - // show only if current activity is shown - if (isActivityShowing && - providerConfigState != SHOWING_PROVIDER_DETAILS) { - providerConfigState = SHOWING_PROVIDER_DETAILS; - Intent intent = new Intent(this, ProviderDetailActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); - intent.putExtra(PROVIDER_KEY, provider); - startActivityForResult(intent, REQUEST_CODE_CONFIGURE_LEAP); - } else { - providerConfigState = PENDING_SHOW_PROVIDER_DETAILS; - } - } - - /** - * Shows an error dialog, if configuring of a provider failed. - */ - public void showDownloadFailedDialog() { - try { - providerConfigState = SHOW_FAILED_DIALOG; - hideConnectionDetails(); - FragmentTransaction fragmentTransaction = fragmentManager.removePreviousFragment(ProviderSetupFailedDialog.TAG); - DialogFragment newFragment; - try { - JSONObject errorJson = new JSONObject(reasonToFail); - newFragment = ProviderSetupFailedDialog.newInstance(provider, errorJson, testNewURL); - } catch (JSONException e) { - e.printStackTrace(); - newFragment = ProviderSetupFailedDialog.newInstance(provider, reasonToFail); - } catch (NullPointerException e) { - //reasonToFail was null - return; - } - newFragment.show(fragmentTransaction, ProviderSetupFailedDialog.TAG); - } catch (IllegalStateException e) { - e.printStackTrace(); - providerConfigState = PENDING_SHOW_FAILED_DIALOG; - } - } - -} diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SignupActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SignupActivity.java deleted file mode 100644 index 16007a70..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SignupActivity.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2018 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package se.leap.bitmaskclient.providersetup.activities; - -import android.os.Bundle; -import androidx.annotation.Nullable; - -import butterknife.OnClick; -import se.leap.bitmaskclient.R; - -import static android.view.View.VISIBLE; - -/** - * Create an account with a provider - */ - -public class SignupActivity extends ProviderCredentialsBaseActivity { - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setProviderHeaderLogo(R.drawable.logo); - setProviderHeaderText(R.string.create_profile); - - setProgressbarTitle(R.string.signing_up); - setButtonText(R.string.signup_button); - - passwordVerificationField.setVisibility(VISIBLE); - passwordVerificationError.setVisibility(VISIBLE); - } - - @Override - @OnClick(R.id.button) - void handleButton() { - super.handleButton(); - if (getPassword().equals(getPasswordVerification())) { - signUp(getUsername(), getPassword()); - } - } -} diff --git a/app/src/main/res/layout-xlarge-port/a_add_provider.xml b/app/src/main/res/layout-xlarge-port/a_add_provider.xml deleted file mode 100644 index 80eef3c3..00000000 --- a/app/src/main/res/layout-xlarge-port/a_add_provider.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.activities.ProviderCredentialsBaseActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.275" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.725" /> - - <include layout="@layout/a_add_provider_tablet_scrollview"/> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml b/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml deleted file mode 100644 index dfb58b8c..00000000 --- a/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_list_layout" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.activities.CustomProviderSetupActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.275" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.725" /> - - <include layout="@layout/a_custom_provider_setup_tablet_linear_layout" /> - -</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml b/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml deleted file mode 100644 index e1295853..00000000 --- a/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.activities.ProviderCredentialsBaseActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.275" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.725" /> - - <include layout="@layout/a_provider_credentials_tablet_linear_layout"/> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-port/a_provider_detail.xml b/app/src/main/res/layout-xlarge-port/a_provider_detail.xml deleted file mode 100644 index 34719df9..00000000 --- a/app/src/main/res/layout-xlarge-port/a_provider_detail.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_list_layout" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.ProviderDetailActivity" - style="@style/BitmaskActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.275" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.725" /> - - <include layout="@layout/a_provider_detail_tablet_linear_layout" /> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-port/a_provider_list.xml b/app/src/main/res/layout-xlarge-port/a_provider_list.xml deleted file mode 100644 index 184cbf93..00000000 --- a/app/src/main/res/layout-xlarge-port/a_provider_list.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_list_layout" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.ProviderListActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.275" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.725" /> - - <include layout="@layout/a_provider_list_tablet_linear_layout" /> -</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout-xlarge/a_add_provider.xml b/app/src/main/res/layout-xlarge/a_add_provider.xml deleted file mode 100644 index db63b32c..00000000 --- a/app/src/main/res/layout-xlarge/a_add_provider.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.activities.ProviderCredentialsBaseActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.15" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.85" /> - - <include layout="@layout/a_add_provider_tablet_scrollview"/> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml b/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml deleted file mode 100644 index 130ad95a..00000000 --- a/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_list_layout" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.activities.CustomProviderSetupActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.15" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.85" /> - - <include layout="@layout/a_custom_provider_setup_tablet_linear_layout" /> - -</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout-xlarge/a_provider_credentials.xml b/app/src/main/res/layout-xlarge/a_provider_credentials.xml deleted file mode 100644 index 61a638d4..00000000 --- a/app/src/main/res/layout-xlarge/a_provider_credentials.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.activities.ProviderCredentialsBaseActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.15" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.85" /> - - <include layout="@layout/a_provider_credentials_tablet_linear_layout"/> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/a_provider_detail.xml b/app/src/main/res/layout-xlarge/a_provider_detail.xml deleted file mode 100644 index 74a0c72c..00000000 --- a/app/src/main/res/layout-xlarge/a_provider_detail.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_list_layout" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.ProviderDetailActivity" - style="@style/BitmaskActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.15" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.85" /> - - <include layout="@layout/a_provider_detail_tablet_linear_layout" /> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/a_provider_list.xml b/app/src/main/res/layout-xlarge/a_provider_list.xml deleted file mode 100644 index c8c7a763..00000000 --- a/app/src/main/res/layout-xlarge/a_provider_list.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_list_layout" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.ProviderListActivity" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - app:srcCompat="@drawable/background_main" - android:scaleType="centerCrop" - /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.2" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.8" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_top" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.15" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_bottom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintGuide_percent="0.85" /> - - <include layout="@layout/a_provider_list_tablet_linear_layout" /> -</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout-xlarge/v_provider_list_item.xml b/app/src/main/res/layout-xlarge/v_provider_list_item.xml deleted file mode 100644 index 2e3506b5..00000000 --- a/app/src/main/res/layout-xlarge/v_provider_list_item.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" - android:paddingTop="2dip" - android:paddingBottom="2dip" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/activatedBackgroundIndicator" - android:minHeight="?android:attr/listPreferredItemHeight" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/provider_domain" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" - android:paddingRight="?android:attr/listPreferredItemPaddingRight" - android:layout_marginTop="6dip" - android:textAppearance="?android:attr/textAppearanceLarge" - /> - - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/provider_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" - android:paddingRight="?android:attr/listPreferredItemPaddingRight" - android:textAppearance="?android:attr/textAppearanceMedium" - /> - -</LinearLayout> diff --git a/app/src/main/res/layout/a_add_provider.xml b/app/src/main/res/layout/a_add_provider.xml deleted file mode 100644 index aad64630..00000000 --- a/app/src/main/res/layout/a_add_provider.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - style="@style/BitmaskActivity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" - tools:context=".providersetup.AddProviderActivity" - tools:viewBindingIgnore="true" - > - - <LinearLayout - android:id="@+id/content" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_alignParentTop="true" - android:orientation="vertical"> - - <!-- the header contains the mask--> - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/text_uri_error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:hint="@string/new_provider_uri" - app:errorEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/text_uri" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ems="10" - android:inputType="text" /> - - </com.google.android.material.textfield.TextInputLayout> - - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <CheckBox - android:id="@+id/danger_checkbox" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:visibility="gone" - android:layout_marginBottom="@dimen/add_button_margin" - /> - - <LinearLayout - android:id="@+id/button_container" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:gravity="right" - android:orientation="horizontal" - android:layout_below="@id/danger_checkbox"> - - <Button - android:id="@+id/button_cancel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/color_font_btn_primary" - android:text="@string/cancel" /> - - <Button - android:id="@+id/button_save" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/add_button_margin" - android:layout_marginStart="@dimen/add_button_margin" - android:enabled="false" - android:textColor="@color/color_font_btn_primary" - android:text="@string/save" /> - - </LinearLayout> - </RelativeLayout> - </LinearLayout> - -</RelativeLayout> diff --git a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml b/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml deleted file mode 100644 index 74904f36..00000000 --- a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ScrollView android:orientation="vertical" - style="@style/BitmaskActivity" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_constraintBottom_toTopOf="@+id/guideline_bottom" - app:layout_constraintEnd_toStartOf="@+id/guideline_right" - app:layout_constraintHeight_min="411dp" - app:layout_constraintStart_toStartOf="@+id/guideline_left" - app:layout_constraintTop_toTopOf="@+id/guideline_top" - android:layout_margin="@dimen/stdpadding" - android:padding="@dimen/stdpadding" - android:background="@color/colorBackground" - android:isScrollContainer="true" - android:fadeScrollbars="false" - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - tools:viewBindingIgnore="true" - xmlns:tools="http://schemas.android.com/tools"> - - <LinearLayout - android:id="@+id/content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/text_uri_error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:hint="@string/new_provider_uri" - app:errorEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/text_uri" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ems="10" - android:inputType="text" /> - - </com.google.android.material.textfield.TextInputLayout> - - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - > - <CheckBox - android:id="@+id/danger_checkbox" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:visibility="gone" - android:layout_marginBottom="@dimen/add_button_margin"/> - - <LinearLayout - android:id="@+id/button_container" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:gravity="right" - android:orientation="horizontal" - android:layout_below="@+id/danger_checkbox" - > - - <Button - android:id="@+id/button_cancel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:minWidth="80dp" - android:textColor="@color/color_font_btn_primary" - android:text="@string/cancel" /> - - <Button - android:id="@+id/button_save" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:minWidth="80dp" - android:layout_marginLeft="@dimen/add_button_margin" - android:layout_marginStart="@dimen/add_button_margin" - android:textColor="@color/color_font_btn_primary" - android:enabled="false" - android:text="@string/save" /> - </LinearLayout> - </RelativeLayout> - </LinearLayout> -</ScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/a_custom_provider_setup.xml b/app/src/main/res/layout/a_custom_provider_setup.xml deleted file mode 100644 index 0e4e3edf..00000000 --- a/app/src/main/res/layout/a_custom_provider_setup.xml +++ /dev/null @@ -1,32 +0,0 @@ -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/custom_provider_setup_layout" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.activities.CustomProviderSetupActivity" - android:padding="@dimen/stdpadding" - style="@style/BitmaskActivity" - tools:viewBindingIgnore="true" - > - - <!-- a "content" view that is required for - ConfigWizardBaseActivities --> - <LinearLayout - android:orientation="horizontal" - android:layout_height="0dp" - android:layout_width="0dp" - android:id="@id/content"> - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:visibility="visible" - /> - </LinearLayout> - - <include layout="@layout/v_loading_screen" - android:visibility="visible" - /> - -</LinearLayout> diff --git a/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml b/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml deleted file mode 100644 index 7e8cd51d..00000000 --- a/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml +++ /dev/null @@ -1,34 +0,0 @@ -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - android:padding="@dimen/stdpadding" - android:background="@color/colorBackground" - app:layout_constraintBottom_toTopOf="@+id/guideline_bottom" - app:layout_constraintEnd_toStartOf="@+id/guideline_right" - app:layout_constraintHeight_min="411dp" - app:layout_constraintStart_toStartOf="@+id/guideline_left" - app:layout_constraintTop_toTopOf="@+id/guideline_top" - tools:viewBindingIgnore="true"> - <!-- a "content" view that is required for - ConfigWizardBaseActivities --> - <LinearLayout - android:orientation="horizontal" - android:layout_height="0dp" - android:layout_width="0dp" - android:id="@id/content"> - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:visibility="visible" - /> - </LinearLayout> - - <include layout="@layout/v_loading_screen" - android:visibility="visible" - /> -</LinearLayout>
\ 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 deleted file mode 100644 index 033aae16..00000000 --- a/app/src/main/res/layout/a_provider_credentials.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" - style="@style/BitmaskActivity" - tools:viewBindingIgnore="true"> - - <include layout="@layout/v_loading_screen" /> - - <LinearLayout - android:id="@+id/content" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent" - > - - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - - <ScrollView - android:layout_height="match_parent" - android:layout_width="match_parent" - android:isScrollContainer="true" - > - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - <include - layout="@layout/v_provider_credentials" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end" - android:enabled="false" - android:textColor="@color/color_font_btn_primary" - android:text="@string/login_button" /> - - </LinearLayout> - </ScrollView> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml deleted file mode 100644 index 73557853..00000000 --- a/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" - style="@style/BitmaskActivity" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - android:padding="@dimen/stdpadding" - android:background="@color/colorBackground" - app:layout_constraintBottom_toTopOf="@+id/guideline_bottom" - app:layout_constraintEnd_toStartOf="@+id/guideline_right" - app:layout_constraintHeight_min="411dp" - app:layout_constraintStart_toStartOf="@+id/guideline_left" - app:layout_constraintTop_toTopOf="@+id/guideline_top" - tools:viewBindingIgnore="true"> - - <include layout="@layout/v_loading_screen" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/content" - android:orientation="vertical"> - - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - - <ScrollView - android:layout_height="match_parent" - android:layout_width="match_parent" - android:isScrollContainer="true" - > - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - <include - layout="@layout/v_provider_credentials" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end" - android:enabled="false" - android:textColor="@color/color_font_btn_primary" - android:text="@string/login_button" /> - - </LinearLayout> - </ScrollView> - </LinearLayout> -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/a_provider_detail.xml b/app/src/main/res/layout/a_provider_detail.xml deleted file mode 100644 index 4a456c32..00000000 --- a/app/src/main/res/layout/a_provider_detail.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_detail_fragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="@dimen/stdpadding" - android:orientation="vertical" - style="@style/BitmaskActivity" - tools:viewBindingIgnore="true"> - - <include layout="@layout/v_loading_screen" /> - - <LinearLayout - android:id="@+id/content" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - <androidx.appcompat.widget.AppCompatTextView - android:id="@+id/provider_detail_description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textStyle="normal" - android:textAppearance="?android:attr/textAppearanceSmall" - android:layout_marginTop="@dimen/standard_margin" - android:layout_marginBottom="@dimen/standard_margin" - /> - - <ListView - android:id="@+id/provider_detail_options" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/standard_margin" - android:drawSelectorOnTop="false"/> - - </LinearLayout> -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml deleted file mode 100644 index 5601a3d5..00000000 --- a/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout android:orientation="vertical" - android:padding="@dimen/stdpadding" - style="@style/BitmaskActivity" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - android:background="@color/colorBackground" - app:layout_constraintBottom_toTopOf="@+id/guideline_bottom" - app:layout_constraintEnd_toStartOf="@+id/guideline_right" - app:layout_constraintHeight_min="411dp" - app:layout_constraintStart_toStartOf="@+id/guideline_left" - app:layout_constraintTop_toTopOf="@+id/guideline_top" - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - tools:viewBindingIgnore="true" - xmlns:tools="http://schemas.android.com/tools"> - - <include layout="@layout/v_loading_screen" /> - - <LinearLayout - android:id="@+id/content" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - - <androidx.appcompat.widget.AppCompatTextView - android:id="@+id/provider_detail_description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textStyle="normal" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_marginTop="@dimen/standard_margin" - android:layout_marginBottom="@dimen/standard_margin" - /> - - <ListView - android:id="@+id/provider_detail_options" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/list_view_margin_top" - android:drawSelectorOnTop="false" - /> - - </LinearLayout> -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/a_provider_list.xml b/app/src/main/res/layout/a_provider_list.xml deleted file mode 100644 index 867d6d8d..00000000 --- a/app/src/main/res/layout/a_provider_list.xml +++ /dev/null @@ -1,34 +0,0 @@ -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/provider_list_layout" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".providersetup.ProviderListActivity" - android:padding="@dimen/stdpadding" - style="@style/BitmaskActivity" - tools:viewBindingIgnore="true"> - - <include layout="@layout/v_loading_screen" /> - - <LinearLayout - android:id="@+id/content" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - <ListView - android:id="@+id/provider_list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:drawSelectorOnTop="false" - android:layout_marginTop="@dimen/standard_margin" - /> - - </LinearLayout> - -</RelativeLayout> diff --git a/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml deleted file mode 100644 index 67f82976..00000000 --- a/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout android:orientation="vertical" - android:padding="@dimen/stdpadding" - style="@style/BitmaskActivity" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - android:background="@color/colorBackground" - app:layout_constraintBottom_toTopOf="@+id/guideline_bottom" - app:layout_constraintEnd_toStartOf="@+id/guideline_right" - app:layout_constraintHeight_min="411dp" - app:layout_constraintStart_toStartOf="@+id/guideline_left" - app:layout_constraintTop_toTopOf="@+id/guideline_top" - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - tools:viewBindingIgnore="true"> - - <include layout="@layout/v_loading_screen" /> - - <LinearLayout - android:id="@+id/content" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <se.leap.bitmaskclient.base.views.ProviderHeaderView - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - - <ListView - android:id="@+id/provider_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:drawSelectorOnTop="false" - android:layout_marginTop="@dimen/list_view_margin_top" - /> - - </LinearLayout> -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/v_provider_credentials.xml b/app/src/main/res/layout/v_provider_credentials.xml deleted file mode 100644 index 189bace6..00000000 --- a/app/src/main/res/layout/v_provider_credentials.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<merge xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools"> - - <androidx.appcompat.widget.AppCompatTextView - android:id="@+id/provider_credentials_user_message" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="@style/TextAppearance.Design.Error" - android:visibility="gone" - android:linksClickable="true" - tools:viewBindingIgnore="true" - /> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/provider_credentials_username_error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/auth_username" - app:errorEnabled="true" - android:layout_marginTop="@dimen/standard_margin" - app:errorTextAppearance="@style/error_appearance"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/provider_credentials_username" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ems="10" - android:inputType="text" /> - - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/provider_credentials_password_error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:passwordToggleEnabled="true" - android:hint="@string/password" - app:errorEnabled="true" - app:errorTextAppearance="@style/error_appearance"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/provider_credentials_password" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" - /> - - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/provider_credentials_password_verification_error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:passwordToggleEnabled="true" - android:hint="@string/password" - app:errorEnabled="true" - android:visibility="gone" - app:errorTextAppearance="@style/error_appearance"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/provider_credentials_password_verification" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" - android:visibility="gone" - /> - - </com.google.android.material.textfield.TextInputLayout> -</merge>
\ No newline at end of file diff --git a/app/src/main/res/layout/v_provider_header.xml b/app/src/main/res/layout/v_provider_header.xml deleted file mode 100644 index 42f4f783..00000000 --- a/app/src/main/res/layout/v_provider_header.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="wrap_content" - android:layout_width="match_parent" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/provider_header_logo" - android:layout_width="@dimen/bitmask_logo" - android:layout_height="@dimen/bitmask_logo" - android:adjustViewBounds="true" - app:srcCompat="@drawable/logo" /> - - <androidx.appcompat.widget.AppCompatTextView - android:id="@+id/provider_header_text" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/provider_header_logo" - android:text="" - android:ellipsize="end" - android:gravity="center_vertical" - android:textAppearance="@style/Base.TextAppearance.AppCompat.Headline" - android:layout_marginTop="@dimen/standard_margin" - android:layout_marginBottom="@dimen/standard_margin" - /> - -</RelativeLayout> diff --git a/app/src/main/res/layout/v_provider_list_item.xml b/app/src/main/res/layout/v_provider_list_item.xml deleted file mode 100644 index 0e7cc7f3..00000000 --- a/app/src/main/res/layout/v_provider_list_item.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" - android:paddingTop="2dip" - android:paddingBottom="2dip" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/activatedBackgroundIndicator" - android:minHeight="?android:attr/listPreferredItemHeight" - tools:viewBindingIgnore="true"> - - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/provider_domain" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" - android:paddingRight="?android:attr/listPreferredItemPaddingRight" - android:layout_marginTop="6dip" - android:textAppearance="?android:attr/textAppearanceListItem" - /> - - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/provider_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" - android:paddingRight="?android:attr/listPreferredItemPaddingRight" - android:textAppearance="?android:attr/textAppearanceSmall" - /> - -</LinearLayout> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 56588bc1..5bddd094 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -237,4 +237,5 @@ <string name="title_setup_success">You\'re all set!</string> <string name="setup_success_description">Click the button below to connect</string> <string name="permission_rejected">Permission request rejected.</string> + <string name="login_not_supported">The current app version doesn\'t support logins, which you need to update your VPN certificate for this provider.</string> </resources> |