From 372a922a8fbc2759d73a0de1e3bba172edc9b9d4 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Mon, 5 Mar 2018 16:24:56 +0100 Subject: 6117 - show cancel if no connection --- .../se/leap/bitmaskclient/VpnNotificationManager.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'app/src') 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); -- cgit v1.2.3