diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-08-02 00:25:45 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-08-02 13:46:52 +0000 |
| commit | 9cf6bab9abd03f97d17279297b44a4c2beab8387 (patch) | |
| tree | 8148215b0a08f406914f1de0ecc9045a198d35d0 /android/src | |
| parent | 4bb534d564648c39d35da18377917a6a72becca5 (diff) | |
| download | mullvadvpn-9cf6bab9abd03f97d17279297b44a4c2beab8387.tar.xz mullvadvpn-9cf6bab9abd03f97d17279297b44a4c2beab8387.zip | |
Show tunnel protocol
Diffstat (limited to 'android/src')
3 files changed, 35 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectFragment.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectFragment.kt index 6d413eef3c..c90a557163 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectFragment.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectFragment.kt @@ -125,6 +125,7 @@ class ConnectFragment : Fragment() { val realState = connectionProxy.state locationInfoCache.state = realState + locationInfo.state = realState headerBar.setState(realState) actionButton.tunnelState = uiState diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt index 41678fe1ce..b890c7b4a2 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt @@ -4,11 +4,15 @@ import android.view.View import android.widget.TextView import net.mullvad.mullvadvpn.model.GeoIpLocation +import net.mullvad.mullvadvpn.model.TunnelState class LocationInfo(val parentView: View) { private val country: TextView = parentView.findViewById(R.id.country) private val city: TextView = parentView.findViewById(R.id.city) private val hostname: TextView = parentView.findViewById(R.id.hostname) + private val protocol: TextView = parentView.findViewById(R.id.tunnel_protocol) + + private var isTunnelInfoVisible = false var location: GeoIpLocation? = null set(value) { @@ -16,4 +20,33 @@ class LocationInfo(val parentView: View) { city.text = value?.city ?: "" hostname.text = value?.hostname ?: "" } + + var state: TunnelState = TunnelState.Disconnected() + set(value) { + field = value + + when (value) { + is TunnelState.Connecting -> isTunnelInfoVisible = true + is TunnelState.Connected -> isTunnelInfoVisible = true + else -> isTunnelInfoVisible = false + } + + updateTunnelInfo() + } + + private fun updateTunnelInfo() { + if (isTunnelInfoVisible) { + showTunnelInfo() + } else { + hideTunnelInfo() + } + } + + private fun hideTunnelInfo() { + protocol.text = "" + } + + private fun showTunnelInfo() { + protocol.setText(R.string.wireguard) + } } diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml index d419e4abc3..318f4e6c46 100644 --- a/android/src/main/res/values/strings.xml +++ b/android/src/main/res/values/strings.xml @@ -60,6 +60,7 @@ <string name="cancel">Cancel</string> <string name="disconnect">Disconnect</string> <string name="switch_location">Switch location</string> + <string name="wireguard">WireGuard</string> <string name="blocking_internet">Blocking internet</string> <string name="auth_failed">Account authentication failed.</string> |
