summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt15
1 files changed, 14 insertions, 1 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt
index f3d2ac2b67..c09de452b9 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt
@@ -9,12 +9,19 @@ import android.view.View
import android.widget.Button
import net.mullvad.mullvadvpn.model.TunnelStateTransition
+import net.mullvad.mullvadvpn.relaylist.RelayItem
class SwitchLocationButton(val parentView: View) {
private val button: Button = parentView.findViewById(R.id.switch_location)
private var updateJob: Job? = null
+ var location: RelayItem? = null
+ set(value) {
+ field = value
+ update()
+ }
+
var state: TunnelStateTransition = TunnelStateTransition.Disconnected()
set(value) {
field = value
@@ -49,6 +56,12 @@ class SwitchLocationButton(val parentView: View) {
}
private fun showLocation() {
- showLabel()
+ val locationName = location?.locationName
+
+ if (locationName == null) {
+ showLabel()
+ } else {
+ button.setText(locationName)
+ }
}
}