From: Tobias Brunner Date: Mon, 18 Jun 2018 14:57:03 +0000 (+0200) Subject: android: Show countdown and retry button in notification X-Git-Tag: 5.7.0dr5~20^2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ec6ad71d3d7d0e03962e07b77a1c87cee54dbd5;p=thirdparty%2Fstrongswan.git android: Show countdown and retry button in notification --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java index b0c12985ed..7910f7d521 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java @@ -417,10 +417,30 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe s = mService.getErrorText(); builder.setSmallIcon(R.drawable.ic_notification_warning); builder.setColor(ContextCompat.getColor(this, R.color.error_text)); - builder.setContentText(getString(R.string.tap_for_details)); + + if (!publicVersion && profile != null) + { + int retry = mService.getRetryIn(); + if (retry > 0) + { + builder.setContentText(getResources().getQuantityString(R.plurals.retry_in, retry, retry)); + builder.setProgress(mService.getRetryTimeout(), retry, false); + } + + Intent intent = new Intent(getApplicationContext(), VpnProfileControlActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setAction(VpnProfileControlActivity.START_PROFILE); + intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString()); + PendingIntent pending = PendingIntent.getActivity(getApplicationContext(), 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT); + builder.addAction(R.drawable.ic_notification_connecting, getString(R.string.retry), pending); + add_action = true; + } } else { + builder.setProgress(0, 0, false); + switch (state) { case CONNECTING: diff --git a/src/frontends/android/app/src/main/res/values-de/strings.xml b/src/frontends/android/app/src/main/res/values-de/strings.xml index 4dc812ca2d..cc107e60ce 100644 --- a/src/frontends/android/app/src/main/res/values-de/strings.xml +++ b/src/frontends/android/app/src/main/res/values-de/strings.xml @@ -31,7 +31,6 @@ strongSwan-Verknüpfung VPN Verbindungsstatus Zeigt Informationen zum Verbindungsstatus der VPN Verbindung und dient als permanente Notification dazu, den VPN Dienst im Hintergrund am Laufen zu halten. - Antippen für Details. Einstellungen diff --git a/src/frontends/android/app/src/main/res/values-pl/strings.xml b/src/frontends/android/app/src/main/res/values-pl/strings.xml index d4cf10ef42..b2ee09288f 100644 --- a/src/frontends/android/app/src/main/res/values-pl/strings.xml +++ b/src/frontends/android/app/src/main/res/values-pl/strings.xml @@ -31,7 +31,6 @@ Skrót strongSwan VPN connection state Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background. - Tap for details. Settings diff --git a/src/frontends/android/app/src/main/res/values-ru/strings.xml b/src/frontends/android/app/src/main/res/values-ru/strings.xml index be34c2d98d..5373fdd1fe 100644 --- a/src/frontends/android/app/src/main/res/values-ru/strings.xml +++ b/src/frontends/android/app/src/main/res/values-ru/strings.xml @@ -28,7 +28,6 @@ Ссылка на strongSwan VPN connection state Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background. - Tap for details. Settings diff --git a/src/frontends/android/app/src/main/res/values-ua/strings.xml b/src/frontends/android/app/src/main/res/values-ua/strings.xml index faad4a758d..a9dfbadd45 100644 --- a/src/frontends/android/app/src/main/res/values-ua/strings.xml +++ b/src/frontends/android/app/src/main/res/values-ua/strings.xml @@ -29,7 +29,6 @@ strongSwan посилання VPN connection state Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background. - Tap for details. Settings diff --git a/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml b/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml index 5b350facc1..501d4bb801 100644 --- a/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml +++ b/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml @@ -28,7 +28,6 @@ strongSwan快捷方式 VPN connection state Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background. - Tap for details. Settings diff --git a/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml b/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml index 4d5afc71bb..f94efda9d3 100644 --- a/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml @@ -28,7 +28,6 @@ strongSwan快速選單 VPN connection state Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background. - Tap for details. Settings diff --git a/src/frontends/android/app/src/main/res/values/strings.xml b/src/frontends/android/app/src/main/res/values/strings.xml index c4b697bcc4..79d6e76b90 100644 --- a/src/frontends/android/app/src/main/res/values/strings.xml +++ b/src/frontends/android/app/src/main/res/values/strings.xml @@ -31,7 +31,6 @@ strongSwan shortcut VPN connection state Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background. - Tap for details. Settings