diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-06-02 22:50:10 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-10-26 23:10:49 +0200 |
commit | 7f58506d3eaff8c26fad336a6fc3caa97e287dd3 (patch) | |
tree | 839db63a8b122f95f8d0e1cd0f5a277e92160c2e /ui/src/main/java/com | |
parent | 5f6e909e610147c9f0d38e72457c79896c3e3e04 (diff) |
tunnel: renew DHCP leases
* Add valid and preferred lifetime to dhcp leases
* Delay renew until VPN network is available
Diffstat (limited to 'ui/src/main/java/com')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt | 7 |
1 files changed, 7 insertions, 0 deletions
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 @@ -170,6 +171,12 @@ object BindingAdapters { } @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) return 0 |