diff options
| author | Arne Schwabe <arne@rfc2549.org> | 2013-03-11 23:12:58 +0100 | 
|---|---|---|
| committer | Arne Schwabe <arne@rfc2549.org> | 2013-03-11 23:12:58 +0100 | 
| commit | 787c024cb5b1401e20fb11e876a74973208c2c55 (patch) | |
| tree | 04a8a737601369e75490834904f6fd2b89645829 | |
| parent | 5b21477afa29b82ccbd98ae2bbb46053a12a703f (diff) | |
Add broadcast sent when VPN Status changes, still needs to tested (closes issue #150)
| -rw-r--r-- | res/layout/about.xml | 12 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/OpenVpnService.java | 10 | 
2 files changed, 16 insertions, 6 deletions
diff --git a/res/layout/about.xml b/res/layout/about.xml index 6766f687..e6abed96 100644 --- a/res/layout/about.xml +++ b/res/layout/about.xml @@ -15,7 +15,7 @@          <Space              android:layout_width="match_parent" -            android:layout_height="10sp" /> +            android:layout_height="12sp" />          <TextView              android:layout_width="match_parent" @@ -25,7 +25,7 @@          <Space              android:layout_width="match_parent" -            android:layout_height="10sp" /> +            android:layout_height="12sp" />          <TextView              android:layout_width="match_parent" @@ -35,7 +35,7 @@          <Space              android:layout_width="match_parent" -            android:layout_height="10sp" /> +            android:layout_height="12sp" />          <TextView              android:id="@+id/donatestring" @@ -44,7 +44,7 @@          <Space              android:layout_width="match_parent" -            android:layout_height="10sp" /> +            android:layout_height="12sp" />          <TextView              android:id="@+id/translation" @@ -54,7 +54,7 @@          <Space              android:layout_width="match_parent" -            android:layout_height="10sp" /> +            android:layout_height="12sp" />          <TextView              android:layout_width="match_parent" @@ -63,7 +63,7 @@          <Space              android:layout_width="match_parent" -            android:layout_height="10sp" /> +            android:layout_height="12sp" />          <TextView              android:layout_width="match_parent" diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index e580089f..9f6da4c3 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method;  import java.util.Locale;  import java.util.Vector; +import android.Manifest.permission;  import android.annotation.TargetApi;  import android.app.Notification;  import android.app.NotificationManager; @@ -542,6 +543,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac  	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 +		doSendBroadcast(state, level);  		if(mProcessThread==null && !mNotificationalwaysVisible)  			return; @@ -564,6 +566,14 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac  		}  	} +	private void doSendBroadcast(String state, ConnectionStatus level) { +		Intent vpnstatus = new Intent(); +		vpnstatus.setAction("de.blinkt.openvpn.VPN_STATUS"); +		vpnstatus.putExtra("status", level.toString()); +		vpnstatus.putExtra("detailstatus", state); +		sendBroadcast(vpnstatus, permission.ACCESS_NETWORK_STATE); +	} +  	@Override  	public void updateByteCount(long in, long out, long diffin, long diffout) {  		if(mDisplayBytecount) {  | 
