diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/Dashboard.java | 2 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 20 |
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; |