summaryrefslogtreecommitdiffhomepage
path: root/ui/src
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-06-04 11:20:55 +0200
commit0cebd39a80468e34fee936f70517225b4a1d2a26 (patch)
tree9fcc9e85ab2354217cb763d08d2734e2d5b93ca9 /ui/src
parente2e31bef58cc00bf814239aef3d97fff69debc67 (diff)
WIP: add valid and preferred lifetime to dhcp leases
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt7
-rw-r--r--ui/src/main/res/layout/tunnel_detail_fragment.xml2
2 files changed, 8 insertions, 1 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
diff --git a/ui/src/main/res/layout/tunnel_detail_fragment.xml b/ui/src/main/res/layout/tunnel_detail_fragment.xml
index 425b364d..9b17a06c 100644
--- a/ui/src/main/res/layout/tunnel_detail_fragment.xml
+++ b/ui/src/main/res/layout/tunnel_detail_fragment.xml
@@ -171,7 +171,7 @@
android:nextFocusDown="@id/dns_servers_text"
android:nextFocusForward="@id/dns_servers_text"
android:onClick="@{ClipboardUtils::copyTextView}"
- android:text="@{tunnel.dhcp.addresses}"
+ android:text="@{tunnel.dhcp}"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:visibility="@{tunnel.dhcp == null ? android.view.View.GONE : android.view.View.VISIBLE}"
app:layout_constraintStart_toStartOf="parent"