From 90c28f492b800b706c1d6f14482baf3e75c4be7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 16 Apr 2015 13:16:04 +0200 Subject: Remove eip switch. --- .../java/se/leap/bitmaskclient/EipFragment.java | 31 ++-------------------- app/src/main/res/layout/eip_service_fragment.xml | 17 ++++-------- 2 files changed, 7 insertions(+), 41 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 454530be..a9ceec52 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -40,8 +40,6 @@ public class EipFragment extends Fragment implements Observer { protected static final String STATUS_MESSAGE = TAG + ".status_message"; public static final String START_ON_BOOT = "start on boot"; - @InjectView(R.id.eipSwitch) - Switch eip_switch; @InjectView(R.id.status_message) TextView status_message; @InjectView(R.id.eipProgress) @@ -74,9 +72,6 @@ public class EipFragment extends Fragment implements Observer { View view = inflater.inflate(R.layout.eip_service_fragment, container, false); ButterKnife.inject(this, view); - if (eip_status.isConnecting()) - eip_switch.setVisibility(View.VISIBLE); - Bundle arguments = getArguments(); if (arguments != null && arguments.containsKey(START_ON_BOOT) && arguments.getBoolean(START_ON_BOOT)) startEipFromScratch(); @@ -110,7 +105,7 @@ public class EipFragment extends Fragment implements Observer { } protected void saveStatus() { - boolean is_on = eip_switch.isChecked(); + boolean is_on = eip_status.isConnected() || eip_status.isConnecting(); Dashboard.preferences.edit().putBoolean(Dashboard.START_ON_BOOT, is_on).commit(); } @@ -125,17 +120,7 @@ public class EipFragment extends Fragment implements Observer { } void handleNewVpnCertificate() { - handleSwitch(!eip_switch.isEnabled()); - } - - @OnCheckedChanged(R.id.eipSwitch) - void handleSwitch(boolean isChecked) { - if (isChecked) - handleSwitchOn(); - else - handleSwitchOff(); - - saveStatus(); + handleIcon(); } private void handleSwitchOn() { @@ -183,7 +168,6 @@ public class EipFragment extends Fragment implements Observer { .setNegativeButton(dashboard.getString(R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - eip_switch.setChecked(true); } }) .show(); @@ -193,13 +177,9 @@ public class EipFragment extends Fragment implements Observer { wants_to_connect = false; eip_status.setConnecting(); progress_bar.setVisibility(View.VISIBLE); - eip_switch.setVisibility(View.VISIBLE); String status = dashboard.getString(R.string.eip_status_start_pending); status_message.setText(status); - if (!eip_switch.isChecked()) { - eip_switch.setChecked(true); - } saveStatus(); eipCommand(Constants.ACTION_START_EIP); } @@ -239,7 +219,6 @@ public class EipFragment extends Fragment implements Observer { .setNegativeButton(dashboard.getString(R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - eip_switch.setChecked(true); } }) .show(); @@ -307,9 +286,6 @@ public class EipFragment extends Fragment implements Observer { private void adjustSwitch() { if (eip_status.isConnected() || eip_status.isConnecting()) { - if (!eip_switch.isChecked()) { - eip_switch.setChecked(true); - } if(eip_status.isConnecting()) { vpn_status_image.showProgress(true); vpn_status_image.setIcon(R.drawable.ic_stat_vpn_empty_halo, R.drawable.ic_stat_vpn_empty_halo); @@ -318,9 +294,6 @@ public class EipFragment extends Fragment implements Observer { vpn_status_image.setIcon(R.drawable.ic_stat_vpn, R.drawable.ic_stat_vpn); } } else { - if (eip_switch.isChecked()) { - eip_switch.setChecked(false); - } vpn_status_image.setIcon(R.drawable.ic_stat_vpn_offline, R.drawable.ic_stat_vpn_offline); vpn_status_image.showProgress(false); } diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index 0cc1df7d..669abef0 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -40,14 +40,6 @@ android:clickable="true" android:text="@string/eip_state_not_connected" /> - - -- cgit v1.2.3