diff options
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt | 14 |
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 |
