summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-11-10 21:54:13 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-12-10 12:55:06 +0000
commitf290a561080948f642b036fad2ee6410a652e1ee (patch)
tree4606dee68679d4b07590a0924d264676c9199896 /android/src
parentb5b0a18da7b0a54c91b8fb70b77f47a1651a347c (diff)
downloadmullvadvpn-f290a561080948f642b036fad2ee6410a652e1ee.tar.xz
mullvadvpn-f290a561080948f642b036fad2ee6410a652e1ee.zip
Animate removal of custom DNS servers
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt
index 38950a6b06..e2d434f7ab 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt
@@ -149,8 +149,17 @@ class CustomDnsAdapter(val customDns: CustomDns) : Adapter<CustomDnsItemHolder>(
}
fun removeDnsServer(address: InetAddress) {
- jobTracker.newBackgroundJob("removeDnsServer $address") {
- customDns.removeDnsServer(address)
+ jobTracker.newUiJob("removeDnsServer $address") {
+ val position = jobTracker.runOnBackground {
+ val index = cachedCustomDnsServers.indexOf(address)
+
+ cachedCustomDnsServers.removeAt(index)
+ customDns.removeDnsServer(address)
+
+ index
+ }
+
+ notifyItemRemoved(position)
}
}