android: Add disconnect button to notification
authorTobias Brunner <tobias@strongswan.org>
Tue, 13 Jun 2017 14:21:50 +0000 (16:21 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 3 Jul 2017 08:39:23 +0000 (10:39 +0200)
src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java
src/frontends/android/app/src/main/res/drawable-hdpi/ic_notification_disconnect.png [new file with mode: 0644]
src/frontends/android/app/src/main/res/drawable-mdpi/ic_notification_disconnect.png [new file with mode: 0644]
src/frontends/android/app/src/main/res/drawable-xhdpi/ic_notification_disconnect.png [new file with mode: 0644]

index 2356817..ecc69ae 100644 (file)
@@ -365,6 +365,11 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
                builder.setContentTitle(getString(s));
                if (!publicVersion)
                {
+                       Intent intent = new Intent(getApplicationContext(), CharonVpnService.class);
+                       intent.setAction(CharonVpnService.DISCONNECT_ACTION);
+                       PendingIntent pending = PendingIntent.getService(getApplicationContext(), 0, intent,
+                                                                                                                        PendingIntent.FLAG_ONE_SHOT);
+                       builder.addAction(R.drawable.ic_notification_disconnect, getString(R.string.disconnect), pending);
                        builder.setContentText(name);
                        builder.setPublicVersion(buildNotification(true));
                }
diff --git a/src/frontends/android/app/src/main/res/drawable-hdpi/ic_notification_disconnect.png b/src/frontends/android/app/src/main/res/drawable-hdpi/ic_notification_disconnect.png
new file mode 100644 (file)
index 0000000..1c94d19
Binary files /dev/null and b/src/frontends/android/app/src/main/res/drawable-hdpi/ic_notification_disconnect.png differ
diff --git a/src/frontends/android/app/src/main/res/drawable-mdpi/ic_notification_disconnect.png b/src/frontends/android/app/src/main/res/drawable-mdpi/ic_notification_disconnect.png
new file mode 100644 (file)
index 0000000..82c7277
Binary files /dev/null and b/src/frontends/android/app/src/main/res/drawable-mdpi/ic_notification_disconnect.png differ
diff --git a/src/frontends/android/app/src/main/res/drawable-xhdpi/ic_notification_disconnect.png b/src/frontends/android/app/src/main/res/drawable-xhdpi/ic_notification_disconnect.png
new file mode 100644 (file)
index 0000000..6dc5e51
Binary files /dev/null and b/src/frontends/android/app/src/main/res/drawable-xhdpi/ic_notification_disconnect.png differ