summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2018-03-05 11:31:41 -0800
committercyberta <cyberta@riseup.net>2018-03-05 11:31:41 -0800
commitfda23fc8c5aa916bce4ce985fcdf0aa08b21f1e6 (patch)
treecca1733d5cb6a95867043bb467bdc4fc90ed9246 /app/src/main
parentd2a68f7f72de06b26aa6ab0a139512455ba0fe76 (diff)
parent372a922a8fbc2759d73a0de1e3bba172edc9b9d4 (diff)
Merge branch '#6117_disconnect_notification' into 'master'
#6117 - show cancel if no connection See merge request leap/bitmask_android!63
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java15
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);