diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-06 18:24:08 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-06 18:24:08 -0600 |
commit | 4bbb1a0fcdc32e1629436acf58437779f5789f3e (patch) | |
tree | b0d9f478d2aebb852772e794101e2ffb9191fa2f /ui/src/main/java/com/wireguard/android/databinding | |
parent | 77b5937fbb8490b368acac85f434113a175f1bba (diff) |
ui: add suffix to persistent keepalive in editor
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java/com/wireguard/android/databinding')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt | 11 |
1 files changed, 11 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 fe828004..055c2f06 100644 --- a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt +++ b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt @@ -151,4 +151,15 @@ object BindingAdapters { fun setInetAddressSetText(view: TextView, addresses: Iterable<InetAddress?>?) { view.text = if (addresses != null) Attribute.join(addresses.map { it?.hostAddress }) else "" } + + @JvmStatic + fun tryParseInt(s: String?): Int { + if (s == null) + return 0 + return try { + Integer.parseInt(s) + } catch (_: Exception) { + 0 + } + } } |