diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-11-04 17:38:19 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-12-10 12:55:06 +0000 |
| commit | 9ff4a665f51992386c21122b04cde3549b6045d6 (patch) | |
| tree | 6c1db0f055386c505adf368513149d76776b1706 /android/src | |
| parent | b230c0c712aadbffddd225cb0cc5ce77b4346b65 (diff) | |
| download | mullvadvpn-9ff4a665f51992386c21122b04cde3549b6045d6.tar.xz mullvadvpn-9ff4a665f51992386c21122b04cde3549b6045d6.zip | |
Add row when adding a new custom DNS server
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/AddCustomDnsServerHolder.kt | 13 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt | 12 |
2 files changed, 23 insertions, 2 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/AddCustomDnsServerHolder.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/AddCustomDnsServerHolder.kt index 5ea8f49e96..1d0f940d4b 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/AddCustomDnsServerHolder.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/AddCustomDnsServerHolder.kt @@ -1,5 +1,16 @@ package net.mullvad.mullvadvpn.ui.customdns import android.view.View +import net.mullvad.mullvadvpn.R -class AddCustomDnsServerHolder(view: View) : CustomDnsItemHolder(view) +class AddCustomDnsServerHolder(view: View, adapter: CustomDnsAdapter) : CustomDnsItemHolder(view) { + init { + view.findViewById<View>(R.id.add).setOnClickListener { + adapter.newDnsServer() + } + + view.findViewById<View>(R.id.click_area).setOnClickListener { + adapter.newDnsServer() + } + } +} 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 7a48b2485b..db89555a8e 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 @@ -68,7 +68,7 @@ class CustomDnsAdapter(val customDns: CustomDns) : Adapter<CustomDnsItemHolder>( } ViewTypes.ADD_SERVER -> { val view = inflater.inflate(R.layout.add_custom_dns_server, parentView, false) - return AddCustomDnsServerHolder(view) + return AddCustomDnsServerHolder(view, this) } ViewTypes.EDIT_SERVER -> { val view = inflater.inflate(R.layout.edit_custom_dns_server, parentView, false) @@ -82,4 +82,14 @@ class CustomDnsAdapter(val customDns: CustomDns) : Adapter<CustomDnsItemHolder>( fun onDestroy() { customDns.onEnabledChanged.unsubscribe(this) } + + fun newDnsServer() { + if (enabled) { + val count = getItemCount() + + enteringNewServer = true + + notifyItemChanged(count - 2) + } + } } |
