summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
authorarne@gaia.fritz.box <arne@gaia.fritz.box>2012-12-25 23:22:13 +0100
committerarne@gaia.fritz.box <arne@gaia.fritz.box>2012-12-25 23:22:13 +0100
commit3018f292ff635d7ec61b3cd02a1e13659819683f (patch)
tree32de630e310e6055124ee92a0d5788a76f6cd94d /src/de/blinkt/openvpn/OpenVpnService.java
parent83dfeaa842bd42840698bdce9a91207a75395b3e (diff)
parent80d073d5fd79e0c57e33e708e6917e9f36c9bebc (diff)
Merge local changes with repository
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java43
1 files changed, 28 insertions, 15 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index ca199cc6..603f86ce 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -19,6 +19,7 @@ package de.blinkt.openvpn;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Locale;
import java.util.Vector;
import android.app.Notification;
@@ -104,22 +105,11 @@ 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);
+ @SuppressWarnings("deprecation")
Notification notification = nbuilder.getNotification();
@@ -127,6 +117,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,11 +449,11 @@ 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
- String ticker = state.toLowerCase();
+ String ticker = state.toLowerCase(Locale.getDefault());
showNotification(state +" " + logmessage,ticker,false,0);
}