summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-07-27 13:01:43 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-07-30 08:55:51 +0000
commited8b5ce170b967df039c10ab65e8381f6dfe3a6a (patch)
treeed11456ccf6a32c390757a51a5d361f5882a3f03 /android
parentb851d0b92c7c97645872f52a822a28d827109adf (diff)
downloadmullvadvpn-ed8b5ce170b967df039c10ab65e8381f6dfe3a6a.tar.xz
mullvadvpn-ed8b5ce170b967df039c10ab65e8381f6dfe3a6a.zip
Remove unnecessary UI scheduling in `LocationInfo`
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt14
1 files changed, 2 insertions, 12 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt
index 4670cd5e12..f1fb1d7860 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt
@@ -1,10 +1,5 @@
package net.mullvad.mullvadvpn
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.Job
-
import android.view.View
import android.widget.TextView
@@ -15,22 +10,17 @@ class LocationInfo(val parentView: View, val locationInfoCache: LocationInfoCach
private val cityLabel: TextView = parentView.findViewById(R.id.city)
private val hostnameLabel: TextView = parentView.findViewById(R.id.hostname)
- private var updateJob: Job? = null
-
init {
locationInfoCache.onNewLocation = { country, city, hostname ->
- updateJob?.cancel()
- updateJob = updateViews(country, city, hostname)
+ updateViews(country, city, hostname)
}
}
fun onDestroy() {
- updateJob?.cancel()
locationInfoCache.onNewLocation = null
}
- fun updateViews(country: String, city: String, hostname: String) =
- GlobalScope.launch(Dispatchers.Main) {
+ fun updateViews(country: String, city: String, hostname: String) {
countryLabel.text = country
cityLabel.text = city
hostnameLabel.text = hostname