android: Add disconnect button to notification

This commit is contained in:
Tobias Brunner 2017-06-13 16:21:50 +02:00
parent aea901bbbe
commit d0ed8ee89e
4 changed files with 5 additions and 0 deletions

View 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));
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B