summaryrefslogtreecommitdiffhomepage
path: root/android/src/main
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-06-21 22:11:14 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-06-24 17:31:05 +0000
commitc9ee66cc6b8c040bf50c156f3022fb89abe809f3 (patch)
treef267792f1cfae10a3b917e90527b98b551c8e021 /android/src/main
parent983bd80f9fe60f5910aa2ce9bd339f5cde275206 (diff)
downloadmullvadvpn-c9ee66cc6b8c040bf50c156f3022fb89abe809f3.tar.xz
mullvadvpn-c9ee66cc6b8c040bf50c156f3022fb89abe809f3.zip
Display location on button
Diffstat (limited to 'android/src/main')
-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)
+ }
}
}