summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/java/com
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-03-07 20:18:07 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-10-24 22:00:28 +0200
commita6e12102c1e14819ea568cf4dd51b230c28b94d6 (patch)
treed94f01060fb977ce3dfb0f2dfe3a72a1fa8cbbf4 /ui/src/main/java/com
parentd7412244b18d760fe364665275ffab5f0332c978 (diff)
WIP: add valid and preferred lifetime to dhcp leases
Diffstat (limited to 'ui/src/main/java/com')
-rw-r--r--ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt7
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