From c9f94cb469f979b4d25eb6ff8728b8972265a21f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 5 Nov 2013 14:17:01 +0100 Subject: broken key icon added + icon is shown on 'not running' notification --- res/drawable-hdpi/ic_vpn_disconnected.png | Bin 0 -> 801 bytes res/drawable-ldpi/ic_vpn_disconnected.png | Bin 0 -> 801 bytes res/drawable-mdpi/ic_vpn_disconnected.png | Bin 0 -> 586 bytes res/drawable-xhdpi/ic_vpn_disconnected.png | Bin 0 -> 1091 bytes src/se/leap/openvpn/OpenVpnService.java | 15 +++++++++++---- 5 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 res/drawable-hdpi/ic_vpn_disconnected.png create mode 100644 res/drawable-ldpi/ic_vpn_disconnected.png create mode 100644 res/drawable-mdpi/ic_vpn_disconnected.png create mode 100644 res/drawable-xhdpi/ic_vpn_disconnected.png diff --git a/res/drawable-hdpi/ic_vpn_disconnected.png b/res/drawable-hdpi/ic_vpn_disconnected.png new file mode 100644 index 00000000..dfb962b9 Binary files /dev/null and b/res/drawable-hdpi/ic_vpn_disconnected.png differ diff --git a/res/drawable-ldpi/ic_vpn_disconnected.png b/res/drawable-ldpi/ic_vpn_disconnected.png new file mode 100644 index 00000000..dfb962b9 Binary files /dev/null and b/res/drawable-ldpi/ic_vpn_disconnected.png differ diff --git a/res/drawable-mdpi/ic_vpn_disconnected.png b/res/drawable-mdpi/ic_vpn_disconnected.png new file mode 100644 index 00000000..f8b02bfb Binary files /dev/null and b/res/drawable-mdpi/ic_vpn_disconnected.png differ diff --git a/res/drawable-xhdpi/ic_vpn_disconnected.png b/res/drawable-xhdpi/ic_vpn_disconnected.png new file mode 100644 index 00000000..7f44c46f Binary files /dev/null and b/res/drawable-xhdpi/ic_vpn_disconnected.png differ diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java index bec7dcee..3ce5a5b2 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; @@ -26,6 +25,7 @@ import android.os.Build; import android.os.IBinder; import android.os.Message; import android.os.ParcelFileDescriptor; +import android.util.Log; import se.leap.openvpn.OpenVPN.StateListener; public class OpenVpnService extends VpnService implements StateListener, Callback { @@ -63,6 +63,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac private static final int OPENVPN_STATUS = 1; public static final int PROTECT_FD = 0; + private static final String OPEN_VPN_SERVICE_TAG = "OPEN_VPN_SERVICE: "; private final IBinder mBinder = new LocalBinder(); @@ -106,9 +107,13 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac private void showNotification(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 (tickerText == getString(R.string.state_noprocess)){ + 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)); @@ -476,7 +481,9 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac // CONNECTED String ticker = getString(resid); boolean persist = ("NOPROCESS".equals(state)) ? false : true; + Log.d(OPEN_VPN_SERVICE_TAG, ticker); showNotification(getString(resid) +" " + logmessage,ticker,false,0,persist); + } } -- cgit v1.2.3