summaryrefslogtreecommitdiff
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
commit5acc0ace25d231b9a3c2d7b3e83541008f94031b (patch)
treea0ee11aa2a23f5f2b8298f066d9de40dadaa8316
parent8f6a13c6e8ad26e44d04520ebf11e1dea9cbae28 (diff)
Minimal rework of notifications for JB
-rw-r--r--AndroidManifest.xml2
-rw-r--r--project.properties2
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java39
3 files changed, 27 insertions, 16 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ad16b0a..8e75f9f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- <uses-permission android:name="com.android.vending.BILLING" /> -->
- <uses-sdk android:minSdkVersion="14" />
+ <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="14"/>
<application
android:icon="@drawable/icon"
diff --git a/project.properties b/project.properties
index 730e911..c4f09d2 100644
--- a/project.properties
+++ b/project.properties
@@ -8,4 +8,4 @@
# project structure.
# Project target.
-target=android-14
+target=android-17
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index ca199cc..122549a 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