summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-02-26 23:12:44 +0100
committerArne Schwabe <arne@rfc2549.org>2013-02-26 23:12:44 +0100
commit428ef31f6a1de54cd6e3c20264f5ab411a076aaa (patch)
tree1ef2ebe6b3364529d712efe27a0eef8e55744dbb /src/de/blinkt/openvpn/OpenVpnService.java
parentbab6645cfb1eb9321e67482d862314a1dbf14f95 (diff)
Refactor ConnectionStatus to be an enumerationv0.5.32
--HG-- extra : rebase_source : 6cf34d83b33bdb25d2311ad9adaa446ac0aac823
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index cecae9d1..c73a1556 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -41,6 +41,7 @@ import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.preference.PreferenceManager;
import de.blinkt.openvpn.OpenVPN.ByteCountListener;
+import de.blinkt.openvpn.OpenVPN.ConnectionStatus;
import de.blinkt.openvpn.OpenVPN.StateListener;
public class OpenVpnService extends VpnService implements StateListener, Callback, ByteCountListener {
@@ -127,7 +128,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
}
- private void showNotification(String msg, String tickerText, boolean lowpriority, long when, int level) {
+ private void showNotification(String msg, String tickerText, boolean lowpriority, long when, ConnectionStatus level) {
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
@@ -144,7 +145,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
nbuilder.setOnlyAlertOnce(true);
nbuilder.setOngoing(true);
nbuilder.setContentIntent(getLogPendingIntent());
- nbuilder.setSmallIcon(icon,level);
+ nbuilder.setSmallIcon(icon,level.level);
if(when !=0)
nbuilder.setWhen(when);
@@ -271,7 +272,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
mProfile = ProfileManager.get(profileUUID);
showNotification("Starting VPN " + mProfile.mName,"Starting VPN " + mProfile.mName,
- false,0,OpenVPN.LEVEL_CONNECTING_NO_SERVER_REPLY_YET);
+ false,0,ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET);
// Set a flag that we are starting a new VPN
mStarting=true;
@@ -538,7 +539,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
@Override
- public void updateState(String state,String logmessage, int resid, int level) {
+ public void updateState(String state,String logmessage, int resid, ConnectionStatus level) {
// If the process is not running, ignore any state,
// Notification should be invisible in this state
if(mProcessThread==null && !mNotificationalwaysVisible)
@@ -547,7 +548,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
// Display byte count only after being connected
{
- if(level == OpenVPN.LEVEL_CONNECTED) {
+ if(level == ConnectionStatus.LEVEL_CONNECTED) {
mDisplayBytecount = true;
mConnecttime = System.currentTimeMillis();
} else {
@@ -573,7 +574,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
humanReadableByteCount(diffout/OpenVPNMangement.mBytecountinterval, true));
boolean lowpriority = !mNotificationalwaysVisible;
- showNotification(netstat,null,lowpriority,mConnecttime, OpenVPN.LEVEL_CONNECTED);
+ showNotification(netstat,null,lowpriority,mConnecttime, ConnectionStatus.LEVEL_CONNECTED);
}
}