summaryrefslogtreecommitdiff
path: root/src/se/leap
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-11-15 13:04:35 -0800
committerSean Leonard <meanderingcode@aetherislands.net>2013-11-15 13:04:35 -0800
commit42d075e993fc345b7684ed4e0e89b732563f7a0c (patch)
tree9133c29cb27e8e3e0acc0a7fa81d2758589ed523 /src/se/leap
parenta95cc0fc7c364e60f2d82dd9ef6749c30a3b229f (diff)
parentd0f6818f93a3978647336191aa104325879cfa13 (diff)
Merge branch 'feature/disconnect-notification-icon' into develop
Diffstat (limited to 'src/se/leap')
-rw-r--r--src/se/leap/bitmaskclient/EipServiceFragment.java12
-rw-r--r--src/se/leap/openvpn/OpenVpnService.java26
2 files changed, 25 insertions, 13 deletions
diff --git a/src/se/leap/bitmaskclient/EipServiceFragment.java b/src/se/leap/bitmaskclient/EipServiceFragment.java
index daf446a5..1b2cfb20 100644
--- a/src/se/leap/bitmaskclient/EipServiceFragment.java
+++ b/src/se/leap/bitmaskclient/EipServiceFragment.java
@@ -132,6 +132,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli
@Override
public void onClick(DialogInterface dialog, int which) {
eipCommand(EIP.ACTION_STOP_EIP);
+ mEipStartPending = false;
}
})
.setNegativeButton(getResources().getString(R.string.eip_cancel_connect_false), new DialogInterface.OnClickListener() {
@@ -177,18 +178,21 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli
String statusMessage = "";
String prefix = getString(localizedResId);
if (state.equals("CONNECTED")){
- statusMessage = "Connection Secure";
+ statusMessage = getString(R.string.eip_state_connected);
getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE);
mEipStartPending = false;
} else if (state.equals("BYTECOUNT")) {
statusMessage = logmessage;
} else if ( (state.equals("NOPROCESS") && !mEipStartPending ) || state.equals("EXITING")) {
- statusMessage = "Not running! Connection not secure!";
+ statusMessage = getString(R.string.eip_state_not_connected);
getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE);
mEipStartPending = false;
switchState = false;
- } else {
- statusMessage = prefix + logmessage;
+ } else if (state.equals("NOPROCESS")){
+ statusMessage = logmessage;
+ }
+ else {
+ statusMessage = prefix + " " + logmessage;
}
eipAutoSwitched = true;
diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java
index bec7dcee..620de204 100644
--- a/src/se/leap/openvpn/OpenVpnService.java
+++ b/src/se/leap/openvpn/OpenVpnService.java
@@ -7,7 +7,6 @@ import java.util.Vector;
import se.leap.bitmaskclient.Dashboard;
import se.leap.bitmaskclient.R;
-
import android.annotation.TargetApi;
import android.app.Notification;
import android.app.NotificationManager;
@@ -103,12 +102,16 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
}
- private void showNotification(String msg, String tickerText, boolean lowpriority, long when, boolean persistant) {
+ private void showNotification(String state, String msg, String tickerText, boolean lowpriority, long when, boolean persistant) {
String ns = Context.NOTIFICATION_SERVICE;
mNotificationManager = (NotificationManager) getSystemService(ns);
-
-
- int icon = R.drawable.ic_stat_vpn;
+ int icon;
+ if (state.equals("NOPROCESS") || state.equals("AUTH_FAILED") || state.equals("NONETWORK")){
+ icon = R.drawable.ic_vpn_disconnected;
+ }else{
+ icon = R.drawable.ic_stat_vpn;
+ }
+
android.app.Notification.Builder nbuilder = new Notification.Builder(this);
nbuilder.setContentTitle(getString(R.string.notifcation_title,mProfile.mName));
@@ -465,8 +468,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
// If the process is not running, ignore any state,
// Notification should be invisible in this state
if(mProcessThread==null)
- return;
-
+ return;
if("CONNECTED".equals(state)) {
mNotificationManager.cancel(OPENVPN_STATUS);
} else if(!"BYTECOUNT".equals(state)) {
@@ -475,8 +477,14 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
// This also mean we are no longer connected, ignore bytecount messages until next
// CONNECTED
String ticker = getString(resid);
- boolean persist = ("NOPROCESS".equals(state)) ? false : true;
- showNotification(getString(resid) +" " + logmessage,ticker,false,0,persist);
+ boolean persist = false;
+ if (("NOPROCESS".equals(state) ) || ("EXIT").equals(state)){
+ showNotification(state, getString(R.string.eip_state_not_connected), ticker, false, 0, persist);
+ }
+ else{
+ persist = true;
+ showNotification(state, getString(resid) +" " + logmessage,ticker,false,0,persist);
+ }
}
}