diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-05-30 19:12:04 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-13 19:29:21 +0000 |
| commit | 365f7c568980c0f4e8b53e6badd0f1f97eadcfd3 (patch) | |
| tree | 7dc415a8514371e8201b545574d8720e19a1aa65 /android/src | |
| parent | 78b8133d9d18a56aaaee0a64ac6c528e69508582 (diff) | |
| download | mullvadvpn-365f7c568980c0f4e8b53e6badd0f1f97eadcfd3.tar.xz mullvadvpn-365f7c568980c0f4e8b53e6badd0f1f97eadcfd3.zip | |
Create `LocationInfo` helper class
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt | 24 |
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 ?: "" + } +} |
