android: Show countdown and retry button in notification

This commit is contained in:
Tobias Brunner
2018-07-03 11:31:39 +02:00
parent 0d9dd4b150
commit 2ec6ad71d3
8 changed files with 21 additions and 8 deletions
@@ -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:
@@ -31,7 +31,6 @@
<string name="strongswan_shortcut">strongSwan-Verknüpfung</string>
<string name="permanent_notification_name">VPN Verbindungsstatus</string>
<string name="permanent_notification_description">Zeigt Informationen zum Verbindungsstatus der VPN Verbindung und dient als permanente Notification dazu, den VPN Dienst im Hintergrund am Laufen zu halten.</string>
<string name="tap_for_details">Antippen für Details.</string>
<!-- Settings -->
<string name="pref_title">Einstellungen</string>
@@ -31,7 +31,6 @@
<string name="strongswan_shortcut">Skrót strongSwan</string>
<string name="permanent_notification_name">VPN connection state</string>
<string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
<string name="tap_for_details">Tap for details.</string>
<!-- Settings -->
<string name="pref_title">Settings</string>
@@ -28,7 +28,6 @@
<string name="strongswan_shortcut">Ссылка на strongSwan</string>
<string name="permanent_notification_name">VPN connection state</string>
<string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
<string name="tap_for_details">Tap for details.</string>
<!-- Settings -->
<string name="pref_title">Settings</string>
@@ -29,7 +29,6 @@
<string name="strongswan_shortcut">strongSwan посилання</string>
<string name="permanent_notification_name">VPN connection state</string>
<string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
<string name="tap_for_details">Tap for details.</string>
<!-- Settings -->
<string name="pref_title">Settings</string>
@@ -28,7 +28,6 @@
<string name="strongswan_shortcut">strongSwan快捷方式</string>
<string name="permanent_notification_name">VPN connection state</string>
<string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
<string name="tap_for_details">Tap for details.</string>
<!-- Settings -->
<string name="pref_title">Settings</string>
@@ -28,7 +28,6 @@
<string name="strongswan_shortcut">strongSwan快速選單</string>
<string name="permanent_notification_name">VPN connection state</string>
<string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
<string name="tap_for_details">Tap for details.</string>
<!-- Settings -->
<string name="pref_title">Settings</string>
@@ -31,7 +31,6 @@
<string name="strongswan_shortcut">strongSwan shortcut</string>
<string name="permanent_notification_name">VPN connection state</string>
<string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
<string name="tap_for_details">Tap for details.</string>
<!-- Settings -->
<string name="pref_title">Settings</string>