From 4a74a0e20f12b25cc78cc5f5f82de8e595dcb13c Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 2 Jun 2023 22:50:10 +0200 Subject: tunnel: renew DHCP leases * Add valid and preferred lifetime to dhcp leases * Delay renew until VPN network is available --- .../main/java/com/wireguard/android/databinding/BindingAdapters.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ui/src/main/java/com/wireguard') diff --git a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt index afba41cb..6b2040e1 100644 --- a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt +++ b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt @@ -20,6 +20,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.wireguard.android.BR import com.wireguard.android.R +import com.wireguard.android.backend.Dhcp; import com.wireguard.android.databinding.ObservableKeyedRecyclerViewAdapter.RowConfigurationHandler import com.wireguard.android.widget.ToggleSwitch import com.wireguard.android.widget.ToggleSwitch.OnBeforeCheckedChangeListener @@ -169,6 +170,12 @@ object BindingAdapters { view.text = if (strings != null) Attribute.join(strings) else "" } + @JvmStatic + @BindingAdapter("android:text") + fun setDhcpLeaseSetText(view: TextView, dhcp: Dhcp?) { + view.text = if (dhcp?.leases != null) Attribute.join(dhcp.leases.map { it }) else "" + } + @JvmStatic fun tryParseInt(s: String?): Int { if (s == null) -- cgit v1.2.3