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/LocationInfo.kt24
1 files changed, 24 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt
new file mode 100644
index 0000000000..5a3290a523
--- /dev/null
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt
@@ -0,0 +1,24 @@
+package net.mullvad.mullvadvpn
+
+import android.view.View
+import android.widget.TextView
+
+import net.mullvad.mullvadvpn.model.GeoIpLocation
+
+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)
+
+ var location: GeoIpLocation? = null
+ set(value) {
+ field = value
+ updateViews(value)
+ }
+
+ fun updateViews(location: GeoIpLocation?) {
+ country.text = location?.country ?: ""
+ city.text = location?.city ?: ""
+ hostname.text = location?.hostname ?: ""
+ }
+}