diff options
Diffstat (limited to 'app/src/main')
41 files changed, 1128 insertions, 171 deletions
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 new file mode 100644 index 00000000..0210077c --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -0,0 +1,654 @@ +/** + * 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.base.fragments; + +import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; +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.EIP_RESTART_ON_BOOT; +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.models.Constants.SHARED_PREFERENCES; +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.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.IBinder; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.TextUtils; +import android.text.style.RelativeSizeSpan; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.ColorRes; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + +import java.util.Observable; +import java.util.Observer; +import java.util.concurrent.atomic.AtomicBoolean; + +import de.blinkt.openvpn.core.ConnectionStatus; +import de.blinkt.openvpn.core.IOpenVPNServiceInternal; +import de.blinkt.openvpn.core.OpenVPNService; +import de.blinkt.openvpn.core.VpnStatus; +import de.blinkt.openvpn.core.connection.Connection; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.FragmentManagerEnhanced; +import se.leap.bitmaskclient.base.MainActivity; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.views.LocationButton; +import se.leap.bitmaskclient.base.views.MainButton; +import se.leap.bitmaskclient.databinding.FEipBinding; +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.tor.TorServiceCommand; +import se.leap.bitmaskclient.tor.TorStatusObservable; + +public class EipFragment extends Fragment implements Observer { + + public final static String TAG = EipFragment.class.getSimpleName(); + + + private SharedPreferences preferences; + private Provider provider; + + AppCompatImageView background; + AppCompatImageView stateView; + MainButton mainButton; + LocationButton locationButton; + AppCompatTextView mainDescription; + AppCompatTextView subDescription; + + private EipStatus eipStatus; + private ProviderObservable providerObservable; + private TorStatusObservable torStatusObservable; + + private GatewaysManager gatewaysManager; + + //---saved Instance ------- + private final String KEY_SHOW_PENDING_START_CANCELLATION = "KEY_SHOW_PENDING_START_CANCELLATION"; + private final String KEY_SHOW_ASK_TO_STOP_EIP = "KEY_SHOW_ASK_TO_STOP_EIP"; + private boolean showPendingStartCancellation = false; + private boolean showAskToStopEip = false; + //------------------------ + AlertDialog alertDialog; + + private IOpenVPNServiceInternal mService; + // We use this service connection to detect if openvpn is running without network + private EipFragmentServiceConnection openVpnConnection; + + @Override + public void onAttach(Context context) { + super.onAttach(context); + Bundle arguments = getArguments(); + Activity activity = getActivity(); + if (activity != null) { + if (arguments != null) { + provider = arguments.getParcelable(PROVIDER_KEY); + if (provider == null) { + handleNoProvider(activity); + } else { + Log.d(TAG, provider.getName() + " configured as provider"); + } + } else { + handleNoProvider(activity); + } + } + } + + 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); + + } + + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + openVpnConnection = new EipFragmentServiceConnection(); + eipStatus = EipStatus.getInstance(); + providerObservable = ProviderObservable.getInstance(); + torStatusObservable = TorStatusObservable.getInstance(); + Activity activity = getActivity(); + if (activity != null) { + preferences = getActivity().getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + } else { + Log.e(TAG, "activity is null in onCreate - no preferences set!"); + } + + gatewaysManager = new GatewaysManager(getContext()); + + + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + FEipBinding binding = FEipBinding.inflate(LayoutInflater.from(getContext()), container, false); + background = binding.background; + mainButton = binding.mainButton; + locationButton = binding.gatewayLocationButton; + locationButton.setTextColor(R.color.black800); + mainDescription = binding.mainDescription; + subDescription = binding.subDescription; + stateView = binding.stateView; + + eipStatus.addObserver(this); + torStatusObservable.addObserver(this); + providerObservable.addObserver(this); + + try { + Bundle arguments = getArguments(); + if (arguments != null && arguments.containsKey(ASK_TO_CANCEL_VPN) && arguments.getBoolean(ASK_TO_CANCEL_VPN)) { + arguments.remove(ASK_TO_CANCEL_VPN); + setArguments(arguments); + askToStopEIP(); + } + } catch (IllegalStateException e) { + // probably setArguments failed because the fragments state is already saved + e.printStackTrace(); + } + + restoreFromSavedInstance(savedInstanceState); + locationButton.setOnClickListener(v -> { + FragmentManagerEnhanced fragmentManager = new FragmentManagerEnhanced(getActivity().getSupportFragmentManager()); + Fragment fragment = new GatewaySelectionFragment(); + fragmentManager.replace(R.id.main_container, fragment, MainActivity.TAG); + }); + + mainButton.setOnClickListener(v -> { + handleIcon(); + }); + return binding.getRoot(); + } + + @Override + public void onStart() { + super.onStart(); + if (DonationReminderDialog.isCallable(getContext())) { + showDonationReminderDialog(); + } + } + + @Override + public void onResume() { + super.onResume(); + if (!eipStatus.isDisconnected()) { + openVpnConnection.bindService(); + } + handleNewState(); + } + + @Override + public void onPause() { + super.onPause(); + openVpnConnection.unbindService(); + } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + if (showAskToStopEip) { + outState.putBoolean(KEY_SHOW_ASK_TO_STOP_EIP, true); + alertDialog.dismiss(); + } else if (showPendingStartCancellation) { + outState.putBoolean(KEY_SHOW_PENDING_START_CANCELLATION, true); + alertDialog.dismiss(); + } + } + + private void restoreFromSavedInstance(Bundle savedInstanceState) { + if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SHOW_PENDING_START_CANCELLATION)) { + showPendingStartCancellation = true; + askPendingStartCancellation(); + } else if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SHOW_ASK_TO_STOP_EIP)) { + showAskToStopEip = true; + askToStopEIP(); + } + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + Activity activity = getActivity(); + if (activity != null) { + ((MainActivity) activity).setDefaultActivityBarColor(); + } + eipStatus.deleteObserver(this); + providerObservable.deleteObserver(this); + torStatusObservable.deleteObserver(this); + background = null; + mainButton = null; + locationButton = null; + mainDescription = null; + subDescription = null; + stateView = null; + } + + private void saveStatus(boolean restartOnBoot) { + preferences.edit().putBoolean(EIP_RESTART_ON_BOOT, restartOnBoot).apply(); + } + + void handleIcon() { + if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnected() || eipStatus.isConnecting() || eipStatus.isUpdatingVpnCert()) + handleSwitchOff(); + else + handleSwitchOn(); + } + + private void handleSwitchOn() { + Context context = getContext(); + if (context == null) { + Log.e(TAG, "context is null when switch turning on"); + return; + } + + if (canStartEIP()) { + startEipFromScratch(); + } else if (canLogInToStartEIP()) { + askUserToLogIn(getString(vpn_certificate_user_message)); + } else { + // provider has no VpnCertificate but user is logged in + updateInvalidVpnCertificate(); + } + } + + private boolean canStartEIP() { + boolean certificateExists = provider.hasVpnCertificate(); + boolean isAllowedAnon = provider.allowsAnonymous(); + 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 (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnecting() || eipStatus.isUpdatingVpnCert()) { + askPendingStartCancellation(); + } else if (eipStatus.isConnected()) { + askToStopEIP(); + } + } + + private void setMainButtonEnabled(boolean enabled) { + locationButton.setEnabled(enabled); + mainButton.setEnabled(enabled); + } + + public void startEipFromScratch() { + saveStatus(true); + Context context = getContext(); + if (context == null) { + Log.e(TAG, "context is null when trying to start VPN"); + return; + } + if (!provider.getGeoipUrl().isDefault() && provider.shouldUpdateGeoIpJson()) { + Bundle bundle = new Bundle(); + bundle.putBoolean(EIP_ACTION_START, true); + bundle.putBoolean(EIP_EARLY_ROUTES, false); + ProviderAPICommand.execute(context, DOWNLOAD_GEOIP_JSON, bundle, provider); + } else { + EipCommand.startVPN(context, false); + } + EipStatus.getInstance().updateState("UI_CONNECTING", "", 0, ConnectionStatus.LEVEL_START); + } + + protected void stopEipIfPossible() { + Context context = getContext(); + if (context == null) { + Log.e(TAG, "context is null when trying to stop EIP"); + return; + } + EipCommand.stopVPN(context); + } + + private void askPendingStartCancellation() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null when asking to cancel"); + return; + } + + try { + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); + showPendingStartCancellation = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) + .setMessage(activity.getString(R.string.eip_cancel_connect_text)) + .setPositiveButton((android.R.string.yes), (dialog, which) -> { + Context context = getContext(); + if (context != null && eipStatus.isUpdatingVpnCert() && + TorStatusObservable.isRunning()) { + TorServiceCommand.stopTorServiceAsync(context.getApplicationContext()); + } + stopEipIfPossible(); + }) + .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { + }).setOnDismissListener(dialog -> showPendingStartCancellation = false).show(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + + } + + protected void askToStopEIP() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null when asking to stop EIP"); + return; + } + try { + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity); + showAskToStopEip = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) + .setMessage(activity.getString(R.string.eip_warning_browser_inconsistency)) + .setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible()) + .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { + }).setOnDismissListener(dialog -> showAskToStopEip = false).show(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + + } + + @Override + public void update(Observable observable, Object data) { + if (observable instanceof EipStatus) { + eipStatus = (EipStatus) observable; + handleNewStateOnMain(); + + if (eipStatus.isConnecting()) { + openVpnConnection.bindService(); + } + if ("NOPROCESS".equals(EipStatus.getInstance().getState())) { + //assure that the Service is shutdown completely if openvpn was stopped + openVpnConnection.unbindService(); + } + } else if (observable instanceof ProviderObservable) { + provider = ((ProviderObservable) observable).getCurrentProvider(); + } else if (observable instanceof TorStatusObservable && EipStatus.getInstance().isUpdatingVpnCert()) { + handleNewStateOnMain(); + } + } + + private void handleNewStateOnMain() { + Activity activity = getActivity(); + if (activity != null) { + activity.runOnUiThread(this::handleNewState); + } else { + Log.e("EipFragment", "activity is null"); + } + } + + private void setActivityBarColor(@ColorRes int primaryColor, @ColorRes int secondaryColor) { + Activity activity = getActivity(); + if (activity == null) { + return; + } + ((MainActivity) getActivity()).setActivityBarColor(primaryColor, secondaryColor, R.color.actionbar_dark_color); + } + + private void handleNewState() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null while trying to handle new state"); + return; + } + + Log.d(TAG, "eip fragment eipStatus state: " + eipStatus.getState() + " - level: " + eipStatus.getLevel() + " - is reconnecting: " + eipStatus.isReconnecting()); + if (eipStatus.isUpdatingVpnCert()) { + setMainButtonEnabled(true); + String city = getPreferredCity(getContext()); + String locationName = VpnStatus.getCurrentlyConnectingVpnName() != null ? + VpnStatus.getCurrentlyConnectingVpnName() : + city == null ? getString(R.string.gateway_selection_recommended_location) : city; + locationButton.setText(locationName); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_connecting); + String torStatus = TorStatusObservable.getStringForCurrentStatus(getContext()); + if (!TextUtils.isEmpty(torStatus)) { + Spannable spannable = new SpannableString(torStatus); + spannable.setSpan(new RelativeSizeSpan(0.75f), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + subDescription.setText(TextUtils.concat(getString(R.string.updating_certificate_message) + "\n", spannable)); + } else { + subDescription.setText(getString(R.string.updating_certificate_message)); + } + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); + mainButton.updateState(false, true, false); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + } else if (eipStatus.isConnecting()) { + setMainButtonEnabled(true); + String city = getPreferredCity(getContext()); + String locationName = VpnStatus.getCurrentlyConnectingVpnName() != null ? + VpnStatus.getCurrentlyConnectingVpnName() : + city == null ? getString(R.string.gateway_selection_recommended_location) : city; + locationButton.setText(locationName); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_connecting); + subDescription.setText(null); + background.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.yellow_mask)); + mainButton.updateState(false, true, false); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + } else if (eipStatus.isConnected()) { + setMainButtonEnabled(true); + mainButton.updateState(true, false, false); + Connection.TransportType transportType = PreferenceHelper.getUseBridges(getContext()) ? Connection.TransportType.OBFS4 : Connection.TransportType.OPENVPN; + locationButton.setLocationLoad(PreferenceHelper.useObfuscationPinning(getContext()) ? GatewaysManager.Load.UNKNOWN : gatewaysManager.getLoadForLocation(VpnStatus.getLastConnectedVpnName(), transportType)); + locationButton.setText(VpnStatus.getLastConnectedVpnName()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); + locationButton.showRecommendedIndicator(getPreferredCity(getContext()) == null); + mainDescription.setText(R.string.eip_status_secured); + subDescription.setText(null); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.green_mask)); + setActivityBarColor(R.color.bg_running_top, R.color.bg_running_top_light_transparent); + } else if(isOpenVpnRunningWithoutNetwork()) { + Log.d(TAG, "eip fragment eipStatus - isOpenVpnRunningWithoutNetwork"); + setMainButtonEnabled(true); + mainButton.updateState(true, false, true); + locationButton.setText(VpnStatus.getCurrentlyConnectingVpnName()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); + locationButton.showRecommendedIndicator(getPreferredCity(getContext())== null); + mainDescription.setText(R.string.eip_state_connected); + subDescription.setText(R.string.eip_state_no_network); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + } else if (eipStatus.isDisconnected() && reconnectingWithDifferentGateway()) { + locationButton.setText(VpnStatus.getCurrentlyConnectingVpnName()); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_connecting); + subDescription.setText(R.string.reconnecting); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + + } else if (eipStatus.isDisconnecting()) { + setMainButtonEnabled(false); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); + mainButton.updateState(false, false, false); + mainDescription.setText(R.string.eip_status_unsecured); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); + } else if (eipStatus.isBlocking()) { + setMainButtonEnabled(true); + mainButton.updateState(true, false, true); + locationButton.setText(getString(R.string.no_location)); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_state_connected); + subDescription.setText(getString(R.string.eip_state_blocking, getString(R.string.app_name))); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); + } else { + locationButton.setText(getContext().getString(R.string.vpn_button_turn_on)); + setMainButtonEnabled(true); + mainButton.updateState(false, false, false); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + String city = getPreferredCity(getContext()); + locationButton.setText(city == null ? getString(R.string.gateway_selection_recommended_location) : city); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_unsecured); + subDescription.setText(null); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); + } + } + + private boolean isOpenVpnRunningWithoutNetwork() { + boolean isRunning = false; + try { + isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && + mService.isVpnRunning(); + } catch (Exception e) { + //eat me + e.printStackTrace(); + } + + return isRunning; + } + + private void updateInvalidVpnCertificate() { + eipStatus.setUpdatingVpnCert(true); + 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); + } + } + + private class EipFragmentServiceConnection implements ServiceConnection { + private final AtomicBoolean bind = new AtomicBoolean(false); + + void bindService() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null when binding OpenVpn"); + return; + } + if (!bind.get()) { + activity.runOnUiThread(() -> { + Intent intent = new Intent(activity, OpenVPNService.class); + intent.setAction(OpenVPNService.START_SERVICE); + + activity.bindService(intent, EipFragmentServiceConnection.this, Context.BIND_AUTO_CREATE); + bind.set(true); + }); + } + } + + void unbindService() { + Activity activity = getActivity(); + if (activity == null) { + return; + } + if (bind.get()) { + activity.runOnUiThread(() -> { + activity.unbindService(EipFragmentServiceConnection.this); + bind.set(false); + }); + } + } + + @Override + public void onServiceConnected(ComponentName className, + IBinder service) { + mService = IOpenVPNServiceInternal.Stub.asInterface(service); + handleNewState(); + } + + @Override + public void onServiceDisconnected(ComponentName arg0) { + mService = null; + } + } + + public void showDonationReminderDialog() { + try { + FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced( + getActivity().getSupportFragmentManager()).removePreviousFragment( + DonationReminderDialog.TAG); + DialogFragment newFragment = new DonationReminderDialog(); + newFragment.setCancelable(false); + newFragment.show(fragmentTransaction, DonationReminderDialog.TAG); + } catch (IllegalStateException | NullPointerException e) { + e.printStackTrace(); + } + } +} diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java b/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java new file mode 100644 index 00000000..715063b5 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java @@ -0,0 +1,57 @@ +package se.leap.bitmaskclient.base.views; + +import android.annotation.TargetApi; +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.RelativeLayout; + +import androidx.appcompat.widget.AppCompatImageView; +import androidx.core.content.ContextCompat; + +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.databinding.VMainButtonBinding; + +public class MainButton extends RelativeLayout { + + private static final String TAG = MainButton.class.getSimpleName(); + + AppCompatImageView button; + + public MainButton(Context context) { + super(context); + initLayout(context); + } + + public MainButton(Context context, AttributeSet attrs) { + super(context, attrs); + initLayout(context); + } + + public MainButton(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initLayout(context); + } + + + @TargetApi(21) + public MainButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + initLayout(context); + } + + private void initLayout(Context context) { + VMainButtonBinding binding = VMainButtonBinding.inflate(LayoutInflater.from(context), this, true); + button = binding.button; + } + + public void updateState(boolean isOn, boolean isProcessing, boolean isError) { + if (isProcessing) { + button.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.button_circle_cancel)); + } else { + button.setImageDrawable( + ContextCompat.getDrawable(getContext(), + isOn ? R.drawable.button_circle_stop : R.drawable.button_circle_start)); + } + } +} diff --git a/app/src/main/res/drawable-hdpi/bg_connected.png b/app/src/main/res/drawable-hdpi/bg_connected.png Binary files differdeleted file mode 100644 index 0e98f705..00000000 --- a/app/src/main/res/drawable-hdpi/bg_connected.png +++ /dev/null diff --git a/app/src/main/res/drawable-hdpi/bg_connecting.png b/app/src/main/res/drawable-hdpi/bg_connecting.png Binary files differdeleted file mode 100644 index 24632712..00000000 --- a/app/src/main/res/drawable-hdpi/bg_connecting.png +++ /dev/null diff --git a/app/src/main/res/drawable-hdpi/bg_disconnected.png b/app/src/main/res/drawable-hdpi/bg_disconnected.png Binary files differdeleted file mode 100644 index de96be57..00000000 --- a/app/src/main/res/drawable-hdpi/bg_disconnected.png +++ /dev/null diff --git a/app/src/main/res/drawable-hdpi/green_mask.png b/app/src/main/res/drawable-hdpi/green_mask.png Binary files differdeleted file mode 100644 index fccc060a..00000000 --- a/app/src/main/res/drawable-hdpi/green_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-hdpi/red_mask.png b/app/src/main/res/drawable-hdpi/red_mask.png Binary files differdeleted file mode 100644 index d2ef7d99..00000000 --- a/app/src/main/res/drawable-hdpi/red_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-hdpi/yellow_mask.png b/app/src/main/res/drawable-hdpi/yellow_mask.png Binary files differdeleted file mode 100644 index 72e3ae45..00000000 --- a/app/src/main/res/drawable-hdpi/yellow_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xhdpi/bg_connected.png b/app/src/main/res/drawable-xhdpi/bg_connected.png Binary files differdeleted file mode 100644 index 915dff95..00000000 --- a/app/src/main/res/drawable-xhdpi/bg_connected.png +++ /dev/null diff --git a/app/src/main/res/drawable-xhdpi/bg_connecting.png b/app/src/main/res/drawable-xhdpi/bg_connecting.png Binary files differdeleted file mode 100644 index be4469df..00000000 --- a/app/src/main/res/drawable-xhdpi/bg_connecting.png +++ /dev/null diff --git a/app/src/main/res/drawable-xhdpi/bg_disconnected.png b/app/src/main/res/drawable-xhdpi/bg_disconnected.png Binary files differdeleted file mode 100644 index 433c776f..00000000 --- a/app/src/main/res/drawable-xhdpi/bg_disconnected.png +++ /dev/null diff --git a/app/src/main/res/drawable-xhdpi/green_mask.png b/app/src/main/res/drawable-xhdpi/green_mask.png Binary files differdeleted file mode 100644 index c852459d..00000000 --- a/app/src/main/res/drawable-xhdpi/green_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xhdpi/red_mask.png b/app/src/main/res/drawable-xhdpi/red_mask.png Binary files differdeleted file mode 100644 index c0d57a03..00000000 --- a/app/src/main/res/drawable-xhdpi/red_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xhdpi/yellow_mask.png b/app/src/main/res/drawable-xhdpi/yellow_mask.png Binary files differdeleted file mode 100644 index d81190fe..00000000 --- a/app/src/main/res/drawable-xhdpi/yellow_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxhdpi/bg_connected.png b/app/src/main/res/drawable-xxhdpi/bg_connected.png Binary files differdeleted file mode 100644 index cd78d865..00000000 --- a/app/src/main/res/drawable-xxhdpi/bg_connected.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxhdpi/bg_connecting.png b/app/src/main/res/drawable-xxhdpi/bg_connecting.png Binary files differdeleted file mode 100644 index 718e102f..00000000 --- a/app/src/main/res/drawable-xxhdpi/bg_connecting.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxhdpi/bg_disconnected.png b/app/src/main/res/drawable-xxhdpi/bg_disconnected.png Binary files differdeleted file mode 100644 index ffbcdb79..00000000 --- a/app/src/main/res/drawable-xxhdpi/bg_disconnected.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxhdpi/bg_switchbar.xml b/app/src/main/res/drawable-xxhdpi/bg_switchbar.xml deleted file mode 100644 index 7af57ad3..00000000 --- a/app/src/main/res/drawable-xxhdpi/bg_switchbar.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (c) 2012-2016 Arne Schwabe - ~ Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt - --> - -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="@color/switchbar" /> -</shape>
\ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/green_mask.png b/app/src/main/res/drawable-xxhdpi/green_mask.png Binary files differdeleted file mode 100644 index 32286177..00000000 --- a/app/src/main/res/drawable-xxhdpi/green_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxhdpi/red_mask.png b/app/src/main/res/drawable-xxhdpi/red_mask.png Binary files differdeleted file mode 100644 index ac560317..00000000 --- a/app/src/main/res/drawable-xxhdpi/red_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxhdpi/yellow_mask.png b/app/src/main/res/drawable-xxhdpi/yellow_mask.png Binary files differdeleted file mode 100644 index 75cf3782..00000000 --- a/app/src/main/res/drawable-xxhdpi/yellow_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxxhdpi/bg_connected.png b/app/src/main/res/drawable-xxxhdpi/bg_connected.png Binary files differdeleted file mode 100644 index 3c9d97b4..00000000 --- a/app/src/main/res/drawable-xxxhdpi/bg_connected.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxxhdpi/bg_connecting.png b/app/src/main/res/drawable-xxxhdpi/bg_connecting.png Binary files differdeleted file mode 100644 index bff2004c..00000000 --- a/app/src/main/res/drawable-xxxhdpi/bg_connecting.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxxhdpi/bg_disconnected.png b/app/src/main/res/drawable-xxxhdpi/bg_disconnected.png Binary files differdeleted file mode 100644 index 2503f135..00000000 --- a/app/src/main/res/drawable-xxxhdpi/bg_disconnected.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxxhdpi/green_mask.png b/app/src/main/res/drawable-xxxhdpi/green_mask.png Binary files differdeleted file mode 100644 index f5a5adaf..00000000 --- a/app/src/main/res/drawable-xxxhdpi/green_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxxhdpi/red_mask.png b/app/src/main/res/drawable-xxxhdpi/red_mask.png Binary files differdeleted file mode 100644 index 9e216955..00000000 --- a/app/src/main/res/drawable-xxxhdpi/red_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxxhdpi/yellow_mask.png b/app/src/main/res/drawable-xxxhdpi/yellow_mask.png Binary files differdeleted file mode 100644 index 806dcbf4..00000000 --- a/app/src/main/res/drawable-xxxhdpi/yellow_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable/bg_connected.png b/app/src/main/res/drawable/bg_connected.png Binary files differdeleted file mode 100644 index 6da7878d..00000000 --- a/app/src/main/res/drawable/bg_connected.png +++ /dev/null diff --git a/app/src/main/res/drawable/bg_connecting.png b/app/src/main/res/drawable/bg_connecting.png Binary files differdeleted file mode 100644 index c371f3f0..00000000 --- a/app/src/main/res/drawable/bg_connecting.png +++ /dev/null diff --git a/app/src/main/res/drawable/bg_disconnected.png b/app/src/main/res/drawable/bg_disconnected.png Binary files differdeleted file mode 100644 index de96be57..00000000 --- a/app/src/main/res/drawable/bg_disconnected.png +++ /dev/null diff --git a/app/src/main/res/drawable/green_mask.png b/app/src/main/res/drawable/green_mask.png Binary files differdeleted file mode 100644 index e515f3f5..00000000 --- a/app/src/main/res/drawable/green_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable/logo.png b/app/src/main/res/drawable/logo.png Binary files differnew file mode 100644 index 00000000..773937ff --- /dev/null +++ b/app/src/main/res/drawable/logo.png diff --git a/app/src/main/res/drawable/red_mask.png b/app/src/main/res/drawable/red_mask.png Binary files differdeleted file mode 100644 index a4bd4a78..00000000 --- a/app/src/main/res/drawable/red_mask.png +++ /dev/null diff --git a/app/src/main/res/drawable/rotate_progress_image.xml b/app/src/main/res/drawable/rotate_progress_image.xml deleted file mode 100644 index 7b539720..00000000 --- a/app/src/main/res/drawable/rotate_progress_image.xml +++ /dev/null @@ -1,12 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" - android:name="circle" - android:viewportWidth="91" - android:viewportHeight="91" - android:width="91dp" - android:height="91dp"> - -<!-- - // implement your rotation animation vector image here ---> - -</vector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/yellow_mask.png b/app/src/main/res/drawable/yellow_mask.png Binary files differdeleted file mode 100644 index 98dd7978..00000000 --- a/app/src/main/res/drawable/yellow_mask.png +++ /dev/null diff --git a/app/src/main/res/layout-port/f_eip.xml b/app/src/main/res/layout-port/f_eip.xml index cb99a700..1b3225cc 100644 --- a/app/src/main/res/layout-port/f_eip.xml +++ b/app/src/main/res/layout-port/f_eip.xml @@ -5,7 +5,6 @@ android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/eipServiceFragment" - tools:viewBindingIgnore="true" > <androidx.constraintlayout.widget.Guideline @@ -13,61 +12,81 @@ android:layout_width="0dp" android:layout_height="0dp" android:orientation="vertical" + app:layout_constraintGuide_percent="0.3" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_center" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.175" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_outer_left" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.225" + app:layout_constraintGuide_percent="0.125" /> + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_outer_right" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.875" + /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline_horizontal_bottom" android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintRight_toRightOf="parent" app:layout_constraintGuide_percent="0.66" /> + <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline_vertical_right" android:layout_width="0dp" android:layout_height="0dp" android:orientation="vertical" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.775" + app:layout_constraintGuide_percent="0.7" /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" + app:srcCompat="@drawable/bg_disconnected" android:scaleType="fitXY" - app:srcCompat="@drawable/background_eip" /> + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + + /> + - <se.leap.bitmaskclient.base.views.MainButton - android:id="@+id/main_button" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_bottom" - app:layout_constraintDimensionRatio="1:1" - app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" - app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" - app:layout_constraintTop_toTopOf="parent" - /> <androidx.appcompat.widget.AppCompatTextView android:id="@+id/main_description" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:layout_constraintTop_toBottomOf="@id/main_button" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toTopOf="@+id/sub_description" android:padding="@dimen/activity_margin" + android:layout_marginTop="@dimen/activity_margin" android:textAppearance="@android:style/TextAppearance.Large" - android:textSize="26sp" android:textStyle="bold" + android:textSize="34sp" + android:autoSizeMinTextSize="28sp" + android:autoSizeTextType="uniform" android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" tools:text="Connection secure" @@ -82,7 +101,6 @@ app:layout_constraintTop_toBottomOf="@id/main_description" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toTopOf="@+id/gateway_location_button" android:padding="@dimen/activity_margin" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" android:textStyle="bold" @@ -94,6 +112,29 @@ android:ellipsize="end" /> + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toTopOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_outer_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_outer_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/state_disconnected" + /> + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@+id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@id/gateway_location_button" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + /> + <se.leap.bitmaskclient.base.views.LocationButton android:id="@+id/gateway_location_button" android:layout_width="match_parent" @@ -104,7 +145,7 @@ android:layout_marginTop="@dimen/stdpadding" android:layout_marginLeft="@dimen/stdpadding" android:layout_marginRight="@dimen/stdpadding" - app:layout_constraintBottom_toBottomOf="@+id/background" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" tools:text="SEATTLE" diff --git a/app/src/main/res/layout-xlarge-port/f_eip.xml b/app/src/main/res/layout-xlarge-port/f_eip.xml index 10b7a7e3..9617b679 100644 --- a/app/src/main/res/layout-xlarge-port/f_eip.xml +++ b/app/src/main/res/layout-xlarge-port/f_eip.xml @@ -1,30 +1,32 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + This is the layout for extra large landscape, extra large portrait + can be found in layout-xlarge-port +--> <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:layout_width="match_parent" android:layout_height="match_parent" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/eipServiceFragment" - tools:viewBindingIgnore="true" > + + <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_horizontal_top" + android:id="@+id/guideline_horizontal_center" android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.0" - app:layout_constraintRight_toRightOf="parent" /> + app:layout_constraintGuide_percent="0.25" + /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline_vertical_left" android:layout_width="0dp" android:layout_height="0dp" android:orientation="vertical" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.2" - /> + app:layout_constraintGuide_percent="0.3" /> <androidx.constraintlayout.widget.Guideline @@ -32,9 +34,22 @@ android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintRight_toRightOf="parent" - app:layout_constraintGuide_percent="0.7" + app:layout_constraintGuide_percent="0.55" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_top" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.875" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.98" /> <androidx.constraintlayout.widget.Guideline @@ -43,46 +58,35 @@ android:layout_height="0dp" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.8" - /> + app:layout_constraintGuide_percent="0.7" /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" - app:srcCompat="@drawable/background_eip" /> + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + app:srcCompat="@drawable/bg_disconnected" /> - <se.leap.bitmaskclient.base.views.MainButton - android:id="@+id/main_button" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_bottom" - app:layout_constraintDimensionRatio="1:1" - app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" - app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" - app:layout_constraintTop_toTopOf="@+id/guideline_horizontal_top" - app:layout_constraintVertical_bias="0.425" /> - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/main_description" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:layout_constraintTop_toBottomOf="@id/main_button" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toTopOf="@+id/sub_description" - android:padding="@dimen/activity_margin" - android:textAppearance="@android:style/TextAppearance.Large" + android:padding="@dimen/stdpadding" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" android:textSize="45sp" android:textStyle="bold" android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" - tools:text="Connection Secure" - android:gravity="center" - android:maxLines="1" + tools:text="Connection secure" /> <androidx.appcompat.widget.AppCompatTextView @@ -92,31 +96,60 @@ app:layout_constraintTop_toBottomOf="@id/main_description" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toTopOf="@+id/gateway_location_button" - android:padding="@dimen/activity_margin" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_center" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" android:textStyle="bold" android:textColor="@color/colorEipFragmentFont" + android:paddingLeft="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:paddingBottom="@dimen/stdpadding" app:layout_constraintDimensionRatio="1:1" - tools:text="A LONG TEXT WITH SEVERAL THINGS BLABLkk" - android:gravity="center" + tools:text="Your traffic is securly routed through \n another" android:maxLines="2" - android:ellipsize="end" + android:gravity="center" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/state_disconnected" + /> + + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_button_top" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + app:layout_constraintDimensionRatio="1:1" /> + <se.leap.bitmaskclient.base.views.LocationButton android:id="@+id/gateway_location_button" android:layout_width="match_parent" - android:layout_height="64dp" - android:layout_marginBottom="@dimen/stdpadding" + android:layout_height="0dp" android:layout_marginEnd="@dimen/stdpadding" android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" android:layout_marginRight="@dimen/stdpadding" - app:layout_constraintBottom_toBottomOf="@+id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_button_top" + app:layout_constraintBottom_toBottomOf="@+id/guideline_horizontal_button_bottom" tools:text="SEATTLE" android:gravity="center_vertical" /> + </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout-xlarge/f_eip.xml b/app/src/main/res/layout-xlarge/f_eip.xml index 10b7a7e3..9617b679 100644 --- a/app/src/main/res/layout-xlarge/f_eip.xml +++ b/app/src/main/res/layout-xlarge/f_eip.xml @@ -1,30 +1,32 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + This is the layout for extra large landscape, extra large portrait + can be found in layout-xlarge-port +--> <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:layout_width="match_parent" android:layout_height="match_parent" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/eipServiceFragment" - tools:viewBindingIgnore="true" > + + <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_horizontal_top" + android:id="@+id/guideline_horizontal_center" android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.0" - app:layout_constraintRight_toRightOf="parent" /> + app:layout_constraintGuide_percent="0.25" + /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline_vertical_left" android:layout_width="0dp" android:layout_height="0dp" android:orientation="vertical" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.2" - /> + app:layout_constraintGuide_percent="0.3" /> <androidx.constraintlayout.widget.Guideline @@ -32,9 +34,22 @@ android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintRight_toRightOf="parent" - app:layout_constraintGuide_percent="0.7" + app:layout_constraintGuide_percent="0.55" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_top" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.875" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.98" /> <androidx.constraintlayout.widget.Guideline @@ -43,46 +58,35 @@ android:layout_height="0dp" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.8" - /> + app:layout_constraintGuide_percent="0.7" /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" - app:srcCompat="@drawable/background_eip" /> + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + app:srcCompat="@drawable/bg_disconnected" /> - <se.leap.bitmaskclient.base.views.MainButton - android:id="@+id/main_button" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_bottom" - app:layout_constraintDimensionRatio="1:1" - app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" - app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" - app:layout_constraintTop_toTopOf="@+id/guideline_horizontal_top" - app:layout_constraintVertical_bias="0.425" /> - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/main_description" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:layout_constraintTop_toBottomOf="@id/main_button" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toTopOf="@+id/sub_description" - android:padding="@dimen/activity_margin" - android:textAppearance="@android:style/TextAppearance.Large" + android:padding="@dimen/stdpadding" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" android:textSize="45sp" android:textStyle="bold" android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" - tools:text="Connection Secure" - android:gravity="center" - android:maxLines="1" + tools:text="Connection secure" /> <androidx.appcompat.widget.AppCompatTextView @@ -92,31 +96,60 @@ app:layout_constraintTop_toBottomOf="@id/main_description" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toTopOf="@+id/gateway_location_button" - android:padding="@dimen/activity_margin" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_center" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" android:textStyle="bold" android:textColor="@color/colorEipFragmentFont" + android:paddingLeft="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:paddingBottom="@dimen/stdpadding" app:layout_constraintDimensionRatio="1:1" - tools:text="A LONG TEXT WITH SEVERAL THINGS BLABLkk" - android:gravity="center" + tools:text="Your traffic is securly routed through \n another" android:maxLines="2" - android:ellipsize="end" + android:gravity="center" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/state_disconnected" + /> + + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_button_top" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + app:layout_constraintDimensionRatio="1:1" /> + <se.leap.bitmaskclient.base.views.LocationButton android:id="@+id/gateway_location_button" android:layout_width="match_parent" - android:layout_height="64dp" - android:layout_marginBottom="@dimen/stdpadding" + android:layout_height="0dp" android:layout_marginEnd="@dimen/stdpadding" android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" android:layout_marginRight="@dimen/stdpadding" - app:layout_constraintBottom_toBottomOf="@+id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_button_top" + app:layout_constraintBottom_toBottomOf="@+id/guideline_horizontal_button_bottom" tools:text="SEATTLE" android:gravity="center_vertical" /> + </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/f_eip.xml b/app/src/main/res/layout/f_eip.xml index 9a823b65..7a6c89c3 100644 --- a/app/src/main/res/layout/f_eip.xml +++ b/app/src/main/res/layout/f_eip.xml @@ -9,7 +9,6 @@ android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/eipServiceFragment" - tools:viewBindingIgnore="true" > <androidx.constraintlayout.widget.Guideline @@ -17,16 +16,22 @@ android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintGuide_percent="0.1" - app:layout_constraintRight_toRightOf="parent" /> + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_center" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.25" + /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline_vertical_left" android:layout_width="0dp" android:layout_height="0dp" android:orientation="vertical" - app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintGuide_percent="0.3" /> @@ -35,16 +40,13 @@ android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintGuide_percent="0.55" - app:layout_constraintRight_toRightOf="parent" /> + app:layout_constraintGuide_percent="0.45" /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline_horizontal_button_top" android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintGuide_percent="0.8" /> @@ -53,9 +55,8 @@ android:layout_width="0dp" android:layout_height="0dp" android:orientation="horizontal" - app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintGuide_percent="0.98" - app:layout_constraintRight_toRightOf="parent" /> + /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline_vertical_right" @@ -70,26 +71,18 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" - app:srcCompat="@drawable/background_eip" /> + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + app:srcCompat="@drawable/bg_disconnected" /> - <se.leap.bitmaskclient.base.views.MainButton - android:id="@+id/main_button" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_margin="@dimen/stdpadding" - app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_top" - app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_bottom" - app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" - app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" - app:layout_constraintDimensionRatio="1:1" - /> - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/main_description" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toTopOf="@+id/sub_description" @@ -112,7 +105,7 @@ app:layout_constraintTop_toBottomOf="@id/main_description" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toTopOf="@+id/gateway_location_button" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_center" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" android:textStyle="bold" android:textColor="@color/colorEipFragmentFont" @@ -127,6 +120,31 @@ android:gravity="center" /> + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/state_disconnected" + /> + + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_button_top" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + app:layout_constraintDimensionRatio="1:1" + /> + + <se.leap.bitmaskclient.base.views.LocationButton android:id="@+id/gateway_location_button" android:layout_width="match_parent" diff --git a/app/src/main/res/layout/v_location_button.xml b/app/src/main/res/layout/v_location_button.xml index e8a0c885..8aaf4978 100644 --- a/app/src/main/res/layout/v_location_button.xml +++ b/app/src/main/res/layout/v_location_button.xml @@ -5,9 +5,9 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_gravity="center_vertical" - android:padding="@dimen/stdpadding" - android:background="@drawable/cust_button_primary_rect" android:layout_height="match_parent" + android:padding="@dimen/stdpadding" + android:background="@drawable/cust_button_light_rect" > <androidx.appcompat.widget.AppCompatImageView @@ -38,31 +38,31 @@ android:visibility="gone" tools:visibility="visible" /> - <androidx.appcompat.widget.AppCompatTextView android:id="@+id/text_location" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_centerInParent="true" - android:layout_gravity="center_vertical" - android:layout_toStartOf="@+id/bridge_icn" - android:layout_toLeftOf="@+id/bridge_icn" - android:layout_toEndOf="@id/recommended_icn" - android:layout_toRightOf="@+id/recommended_icn" - android:ellipsize="end" - android:gravity="center_vertical" - android:maxLines="1" android:paddingStart="@dimen/stdpadding" android:paddingLeft="@dimen/stdpadding" android:paddingEnd="@dimen/stdpadding" android:paddingRight="@dimen/stdpadding" + android:maxLines="1" + android:ellipsize="end" + android:layout_height="match_parent" + android:layout_width="match_parent" + app:autoSizeTextType="uniform" + android:gravity="center_vertical" + app:autoSizeMinTextSize="15sp" + app:autoSizeMaxTextSize="24sp" + android:layout_toEndOf="@id/recommended_icn" + android:layout_toRightOf="@+id/recommended_icn" + android:layout_toLeftOf="@+id/bridge_icn" + android:layout_toStartOf="@+id/bridge_icn" + android:layout_gravity="center_vertical" + android:layout_centerInParent="true" android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textStyle="bold" - android:textColor="@color/colorLocationButtonTint" - app:autoSizeMaxTextSize="24sp" - app:autoSizeMinTextSize="15sp" - app:autoSizeTextType="uniform" - tools:text="Seattle along message" /> + android:textColor="@color/white" + tools:text="Seattle along message" + /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/bridge_icn" diff --git a/app/src/main/res/layout/v_main_button.xml b/app/src/main/res/layout/v_main_button.xml new file mode 100644 index 00000000..e3f96693 --- /dev/null +++ b/app/src/main/res/layout/v_main_button.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/vpn_btn_guideline_left" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.125" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/vpn_btn_guideline_right" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.875" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/vpn_btn_guideline_top" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.125" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/vpn_btn_guideline_bottom" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.875" /> + + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/icn_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/icn_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/icn_guideline_top" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.2" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/icn_guideline_bottom" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.8" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/border_guideline_left" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.025" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/border_guideline_right" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.975" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/border_guideline_top" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.025" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/border_guideline_bottom" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.975" /> + + + <!-- <ProgressBar + android:id="@+id/progressBar" + style="@style/Widget.AppCompat.ProgressBar.Horizontal" + + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toBottomOf="@id/border_guideline_bottom" + app:layout_constraintEnd_toEndOf="@id/border_guideline_right" + app:layout_constraintStart_toStartOf="@id/border_guideline_left" + app:layout_constraintTop_toTopOf="@id/border_guideline_top" + app:layout_constraintDimensionRatio="1:1" + android:indeterminate="true" + android:indeterminateDuration="800" + android:indeterminateDrawable="@drawable/progressbar_circle" + android:interpolator="@android:anim/decelerate_interpolator" + android:indeterminateBehavior="cycle" + />--> + + <!--<androidx.appcompat.widget.AppCompatImageView + android:id="@+id/progress_circular" + android:layout_width="0dp" + android:layout_height="0dp" + android:scaleType="fitXY" + + app:layout_constraintTop_toTopOf="@+id/button" + app:layout_constraintBottom_toBottomOf="@+id/button" + app:layout_constraintLeft_toLeftOf="@+id/button" + app:layout_constraintRight_toRightOf="@+id/button" + app:layout_constraintDimensionRatio="1:1" + android:src="@drawable/rainbow_circle" />--> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/button" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@+id/vpn_btn_guideline_bottom" + app:layout_constraintEnd_toStartOf="@+id/vpn_btn_guideline_right" + app:layout_constraintStart_toStartOf="@+id/vpn_btn_guideline_left" + app:layout_constraintTop_toTopOf="@+id/vpn_btn_guideline_top" + app:layout_constraintDimensionRatio="1:1" + app:srcCompat="@drawable/button_circle_start" + /> + + + + + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file |