diff options
author | Fup Duck <fupduck@sacknagel.com> | 2018-03-05 16:24:56 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2018-03-05 16:24:56 +0100 |
commit | 372a922a8fbc2759d73a0de1e3bba172edc9b9d4 (patch) | |
tree | cca1733d5cb6a95867043bb467bdc4fc90ed9246 /app | |
parent | d2a68f7f72de06b26aa6ab0a139512455ba0fe76 (diff) |
6117 - show cancel if no connection
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java b/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java index 459f337b..8a329085 100644 --- a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java @@ -111,8 +111,21 @@ public class VpnNotificationManager { * @param when */ public void buildOpenVpnNotification(String profileName, final String msg, String tickerText, ConnectionStatus status, long when, String notificationChannelNewstatusId) { + String cancelString; + switch (status) { + // show cancel if no connection + case LEVEL_START: + case LEVEL_NONETWORK: + case LEVEL_CONNECTING_SERVER_REPLIED: + case LEVEL_CONNECTING_NO_SERVER_REPLY_YET: + cancelString = context.getString(R.string.cancel); + break; + // show disconnect if connection exists + default: + cancelString = context.getString(R.string.cancel_connection); + } NotificationCompat.Action.Builder actionBuilder = new NotificationCompat.Action. - Builder(R.drawable.ic_menu_close_clear_cancel, context.getString(R.string.cancel_connection), getDisconnectIntent()); + Builder(R.drawable.ic_menu_close_clear_cancel, cancelString, getDisconnectIntent()); String title; if (isEmpty(profileName)) { title = context.getString(R.string.app_name); |