summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-12-17 12:39:41 +0100
committerParménides GV <parmegv@sdf.org>2014-12-17 12:39:41 +0100
commit5d05a628fbd833860abfc85bb450186ec8dedf19 (patch)
tree69c09df37ca692d269a1ad8dba7692a76510b001 /app/src/main/java
parent63ae29d808da4c85c223f2e2b6824322b8fc45df (diff)
Small refactor to stop EIP methods.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java20
2 files changed, 13 insertions, 9 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index cca9c63c..e32dbdee 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -292,7 +292,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
if (preferences.getBoolean(Constants.AUTHED_EIP, false)) {
logOut();
}
- eip_fragment.stopEIP();
+ eip_fragment.askToStopEIP();
}
preferences.edit().clear().apply();
startActivityForResult(new Intent(this,ConfigurationWizard.class), SWITCH_PROVIDER);
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
index fc412449..420da7a1 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
@@ -161,7 +161,7 @@ public class EipFragment extends Fragment implements Observer {
if(eip_status.isConnecting()) {
askPendingStartCancellation();
} else if(eip_status.isConnected()) {
- stopEIP();
+ askToStopEIP();
}
}
@@ -172,7 +172,7 @@ public class EipFragment extends Fragment implements Observer {
.setPositiveButton((R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- stopEIP();
+ askToStopEIP();
}
})
.setNegativeButton(parent_activity.getString(R.string.no), new DialogInterface.OnClickListener() {
@@ -198,7 +198,15 @@ public class EipFragment extends Fragment implements Observer {
eipCommand(Constants.ACTION_START_EIP);
}
- protected void stopEIP() {
+ private void stopEIP() {
+ if(eip_status.isConnecting())
+ VoidVpnService.stop();
+ Intent disconnect_vpn = new Intent(parent_activity, DisconnectVPN.class);
+ parent_activity.startActivityForResult(disconnect_vpn, EIP.DISCONNECT);
+ eip_status.setDisconnecting();
+ }
+
+ protected void askToStopEIP() {
hideProgressBar();
String status = parent_activity.getString(R.string.eip_state_not_connected);
@@ -313,11 +321,7 @@ public class EipFragment extends Fragment implements Observer {
} else if (request.equals(Constants.ACTION_STOP_EIP)) {
switch (resultCode){
case Activity.RESULT_OK:
- if(eip_status.isConnecting())
- VoidVpnService.stop();
- Intent disconnect_vpn = new Intent(parent_activity, DisconnectVPN.class);
- parent_activity.startActivityForResult(disconnect_vpn, EIP.DISCONNECT);
- eip_status.setDisconnecting();
+ stopEIP();
break;
case Activity.RESULT_CANCELED:
break;