summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-12-15 20:36:44 +0100
committerArne Schwabe <arne@rfc2549.org>2012-12-15 20:36:44 +0100
commit46290f01887ac0b24e014aa9cf37b8f7cd50585b (patch)
treea39073ef71203d037ac78db4eeaaf36199d90853 /src
parent66d5f00763b30d84e12e3fc949d033a18e93f625 (diff)
Minimal rework of notifications for JB
Diffstat (limited to 'src')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index ca199cc6..122549a5 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -104,19 +104,7 @@ public class OpenVpnService extends VpnService implements StateListener {
// Try to set the priority available since API 16 (Jellybean)
- if( lowpriority) {
- try {
- Method setpriority = nbuilder.getClass().getMethod("setPriority", int.class);
- // PRIORITY_MIN == -2
- setpriority.invoke(nbuilder, -2 );
-
- //ignore exception
- } catch (NoSuchMethodException nsm) {
- } catch (IllegalArgumentException e) {
- } catch (IllegalAccessException e) {
- } catch (InvocationTargetException e) {
- }
- }
+ jbNotificationExtras(lowpriority, nbuilder);
if(tickerText!=null)
nbuilder.setTicker(tickerText);
@@ -127,6 +115,29 @@ public class OpenVpnService extends VpnService implements StateListener {
startForeground(OPENVPN_STATUS, notification);
}
+ private void jbNotificationExtras(boolean lowpriority,
+ android.app.Notification.Builder nbuilder) {
+ try {
+ if( lowpriority) {
+ Method setpriority = nbuilder.getClass().getMethod("setPriority", int.class);
+ // PRIORITY_MIN == -2
+ setpriority.invoke(nbuilder, -2 );
+
+/* PendingIntent cancelconnet=null;
+
+ nbuilder.addAction(android.R.drawable.ic_menu_close_clear_cancel,
+ getString(R.string.cancel_connection),cancelconnet); */
+ }
+
+ //ignore exception
+ } catch (NoSuchMethodException nsm) {
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InvocationTargetException e) {
+ }
+
+ }
+
PendingIntent getLogPendingIntent() {
// Let the configure Button show the Log
Intent intent = new Intent(getBaseContext(),LogWindow.class);
@@ -436,7 +447,7 @@ public class OpenVpnService extends VpnService implements StateListener {
} else {
mDisplayBytecount = false;
}
-
+
// Other notifications are shown,
// This also mean we are no longer connected, ignore bytecount messages until next
// CONNECTED