summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt15
-rw-r--r--android/src/main/res/layout/connect.xml2
-rw-r--r--android/src/main/res/values/strings.xml5
3 files changed, 15 insertions, 7 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt
index cd8c1d21c4..b90b3aa251 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt
@@ -1,5 +1,6 @@
package net.mullvad.mullvadvpn
+import android.widget.TextView
import android.view.View
import net.mullvad.mullvadvpn.model.KeygenEvent
@@ -7,6 +8,8 @@ import net.mullvad.mullvadvpn.model.TunnelState
class NotificationBanner(val parentView: View) {
private val banner: View = parentView.findViewById(R.id.notification_banner)
+ private val title: TextView = parentView.findViewById(R.id.notification_title)
+
private var visible = false
var keyState: KeygenEvent? = null
@@ -29,8 +32,8 @@ class NotificationBanner(val parentView: View) {
when (keyState) {
null -> return false
is KeygenEvent.NewKey -> return false
- is KeygenEvent.TooManyKeys -> show()
- is KeygenEvent.GenerationFailure -> show()
+ is KeygenEvent.TooManyKeys -> show(R.string.too_many_keys)
+ is KeygenEvent.GenerationFailure -> show(R.string.failed_to_generate_key)
}
return true
@@ -40,21 +43,23 @@ class NotificationBanner(val parentView: View) {
when (tunnelState) {
is TunnelState.Disconnecting -> hide()
is TunnelState.Disconnected -> hide()
- is TunnelState.Connecting -> show()
+ is TunnelState.Connecting -> show(R.string.blocking_internet)
is TunnelState.Connected -> hide()
- is TunnelState.Blocked -> show()
+ is TunnelState.Blocked -> show(R.string.blocking_internet)
}
return true
}
- private fun show() {
+ private fun show(message: Int) {
if (!visible) {
visible = true
banner.visibility = View.VISIBLE
banner.translationY = -banner.height.toFloat()
banner.animate().translationY(0.0F).setDuration(350).start()
}
+
+ title.setText(message)
}
private fun hide() {
diff --git a/android/src/main/res/layout/connect.xml b/android/src/main/res/layout/connect.xml
index 5c2beb1e2e..38298d2882 100644
--- a/android/src/main/res/layout/connect.xml
+++ b/android/src/main/res/layout/connect.xml
@@ -62,7 +62,7 @@
android:layout_marginLeft="19dp"
android:src="@drawable/icon_notification_error"
/>
- <TextView
+ <TextView android:id="@+id/notification_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml
index a3da5d4e96..711be12793 100644
--- a/android/src/main/res/values/strings.xml
+++ b/android/src/main/res/values/strings.xml
@@ -54,12 +54,15 @@
<string name="unsecured_connection">Unsecured connection</string>
<string name="creating_secure_connection">Creating secure connection</string>
<string name="secure_connection">Secure connection</string>
- <string name="blocking_internet">Blocking internet</string>
<string name="connect">Secure my connection</string>
<string name="cancel">Cancel</string>
<string name="disconnect">Disconnect</string>
<string name="switch_location">Switch location</string>
+ <string name="blocking_internet">Blocking internet</string>
+ <string name="too_many_keys">Too many WireGuard keys registered to account</string>
+ <string name="failed_to_generate_key">Failed to generate WireGuard key</string>
+
<string name="select_location">Select location</string>
<string name="select_location_description">
While connected, your real location is masked with a private and secure location in the