diff options
-rw-r--r-- | ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt | 13 | ||||
-rw-r--r-- | ui/src/main/res/layout/tunnel_detail_fragment.xml | 80 | ||||
-rw-r--r-- | ui/src/main/res/layout/tunnel_detail_peer.xml | 66 | ||||
-rw-r--r-- | ui/src/main/res/values-de/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values-hi/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values-id/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values-it/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values-ja/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values-ru/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values-sl/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values-zh-rCN/strings.xml | 1 | ||||
-rw-r--r-- | ui/src/main/res/values/strings.xml | 6 |
12 files changed, 157 insertions, 16 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 05d69aec..fe828004 100644 --- a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt +++ b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.kt @@ -26,6 +26,7 @@ import com.wireguard.android.widget.ToggleSwitch.OnBeforeCheckedChangeListener import com.wireguard.config.Attribute import com.wireguard.config.InetNetwork import java9.util.Optional +import java.net.InetAddress /** * Static methods for use by generated code in the Android data binding library. @@ -135,13 +136,19 @@ object BindingAdapters { @JvmStatic @BindingAdapter("android:text") - fun setText(view: TextView, text: Optional<*>) { - view.text = text.map { it.toString() }.orElse("") + fun setOptionalText(view: TextView, text: Optional<*>?) { + view.text = text?.map { it.toString() }?.orElse("") ?: "" } @JvmStatic @BindingAdapter("android:text") - fun setText(view: TextView, networks: Iterable<InetNetwork?>?) { + fun setInetNetworkSetText(view: TextView, networks: Iterable<InetNetwork?>?) { view.text = if (networks != null) Attribute.join(networks) else "" } + + @JvmStatic + @BindingAdapter("android:text") + fun setInetAddressSetText(view: TextView, addresses: Iterable<InetAddress?>?) { + view.text = if (addresses != null) Attribute.join(addresses.map { it?.hostAddress }) else "" + } } diff --git a/ui/src/main/res/layout/tunnel_detail_fragment.xml b/ui/src/main/res/layout/tunnel_detail_fragment.xml index 0bb3558c..9fbd4722 100644 --- a/ui/src/main/res/layout/tunnel_detail_fragment.xml +++ b/ui/src/main/res/layout/tunnel_detail_fragment.xml @@ -28,6 +28,7 @@ android:background="?attr/colorBackground" android:clickable="true" android:focusable="true"> + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content"> @@ -81,6 +82,8 @@ style="@style/DetailText" android:layout_width="match_parent" android:layout_height="wrap_content" + android:contentDescription="@string/name" + android:onClick="@{ClipboardUtils::copyTextView}" android:text="@{tunnel.name}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/interface_name_label" @@ -101,7 +104,7 @@ style="@style/DetailText" android:layout_width="match_parent" android:layout_height="wrap_content" - android:contentDescription="@string/public_key_description" + android:contentDescription="@string/public_key" android:ellipsize="end" android:maxLines="1" android:onClick="@{ClipboardUtils::copyTextView}" @@ -118,6 +121,7 @@ android:layout_marginTop="8dp" android:labelFor="@+id/addresses_text" android:text="@string/addresses" + android:visibility="@{config.interface.addresses.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/public_key_text" /> @@ -127,10 +131,84 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:contentDescription="@string/addresses" + android:onClick="@{ClipboardUtils::copyTextView}" android:text="@{config.interface.addresses}" + android:visibility="@{config.interface.addresses.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/addresses_label" tools:text="fc00:bbbb:bbbb:bb11::3:368b/128" /> + + <TextView + android:id="@+id/dns_servers_label" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:labelFor="@+id/dns_servers_text" + android:text="@string/dns_servers" + android:visibility="@{config.interface.dnsServers.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/addresses_text" /> + + <TextView + android:id="@+id/dns_servers_text" + style="@style/DetailText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:contentDescription="@string/dns_servers" + android:onClick="@{ClipboardUtils::copyTextView}" + android:text="@{config.interface.dnsServers}" + android:visibility="@{config.interface.dnsServers.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/dns_servers_label" + tools:text="8.8.8.8, 8.8.4.4" /> + + <TextView + android:id="@+id/listen_port_label" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:labelFor="@+id/listen_port_text" + android:text="@string/listen_port" + android:visibility="@{config.interface.listenPort.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/dns_servers_text" /> + + <TextView + android:id="@+id/listen_port_text" + style="@style/DetailText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:contentDescription="@string/listen_port" + android:onClick="@{ClipboardUtils::copyTextView}" + android:text="@{config.interface.listenPort}" + android:visibility="@{config.interface.listenPort.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/listen_port_label" + tools:text="51820" /> + + <TextView + android:id="@+id/mtu_label" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:labelFor="@+id/mtu_text" + android:text="@string/mtu" + android:visibility="@{config.interface.mtu.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/listen_port_text" /> + + <TextView + android:id="@+id/mtu_text" + style="@style/DetailText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:contentDescription="@string/mtu" + android:onClick="@{ClipboardUtils::copyTextView}" + android:text="@{config.interface.mtu}" + android:visibility="@{config.interface.mtu.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/mtu_label" + tools:text="1500" /> </androidx.constraintlayout.widget.ConstraintLayout> </com.google.android.material.card.MaterialCardView> diff --git a/ui/src/main/res/layout/tunnel_detail_peer.xml b/ui/src/main/res/layout/tunnel_detail_peer.xml index a73716d7..d0de329b 100644 --- a/ui/src/main/res/layout/tunnel_detail_peer.xml +++ b/ui/src/main/res/layout/tunnel_detail_peer.xml @@ -45,7 +45,7 @@ style="@style/DetailText" android:layout_width="match_parent" android:layout_height="wrap_content" - android:contentDescription="@string/public_key_description" + android:contentDescription="@string/public_key" android:ellipsize="end" android:maxLines="1" android:onClick="@{ClipboardUtils::copyTextView}" @@ -56,21 +56,51 @@ tools:text="wOs2eguFEohqIZxlSJ1CAT9584tc6ejj9hfGFsoBVkA=" /> <TextView + android:id="@+id/pre_shared_key_label" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:labelFor="@+id/pre_shared_key_text" + android:text="@string/pre_shared_key" + android:visibility="@{item.preSharedKey.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/public_key_text" /> + + <TextView + android:id="@+id/pre_shared_key_text" + style="@style/DetailText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:contentDescription="@string/pre_shared_key" + android:ellipsize="end" + android:maxLines="1" + android:singleLine="true" + android:text="@string/pre_shared_key_enabled" + android:visibility="@{item.preSharedKey.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/pre_shared_key_label" + tools:text="8VyS8W8XeMcBWfKp1GuG3/fZlnUQFkqMNbrdmZtVQIM=" /> + + <TextView android:id="@+id/allowed_ips_label" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:labelFor="@+id/allowed_ips_text" android:text="@string/allowed_ips" + android:visibility="@{item.allowedIps.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/public_key_text" /> + app:layout_constraintTop_toBottomOf="@+id/pre_shared_key_text" /> <TextView android:id="@+id/allowed_ips_text" style="@style/DetailText" android:layout_width="match_parent" android:layout_height="wrap_content" + android:contentDescription="@string/allowed_ips" + android:onClick="@{ClipboardUtils::copyTextView}" android:text="@{item.allowedIps}" + android:visibility="@{item.allowedIps.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/allowed_ips_label" tools:text="0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3" /> @@ -82,6 +112,7 @@ android:layout_marginTop="8dp" android:labelFor="@+id/endpoint_text" android:text="@string/endpoint" + android:visibility="@{item.endpoint.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/allowed_ips_text" /> @@ -90,12 +121,39 @@ style="@style/DetailText" android:layout_width="match_parent" android:layout_height="wrap_content" + android:contentDescription="@string/endpoint" + android:onClick="@{ClipboardUtils::copyTextView}" android:text="@{item.endpoint}" + android:visibility="@{item.endpoint.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/endpoint_label" tools:text="192.168.0.1:51820" /> <TextView + android:id="@+id/persistent_keepalive_label" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:labelFor="@+id/persistent_keepalive_text" + android:text="@string/persistent_keepalive" + android:visibility="@{item.persistentKeepalive.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/endpoint_text" /> + + <TextView + android:id="@+id/persistent_keepalive_text" + style="@style/DetailText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:contentDescription="@string/persistent_keepalive" + android:onClick="@{ClipboardUtils::copyTextView}" + android:text="@{@plurals/persistent_keepalive_seconds_unit(item.persistentKeepalive.orElse(0), item.persistentKeepalive.orElse(0))}" + android:visibility="@{item.persistentKeepalive.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/persistent_keepalive_label" + tools:text="every 3 seconds" /> + + <TextView android:id="@+id/transfer_label" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -105,7 +163,7 @@ android:text="@string/transfer" android:visibility="gone" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/endpoint_text" + app:layout_constraintTop_toBottomOf="@+id/persistent_keepalive_text" tools:visibility="visible" /> <TextView @@ -114,6 +172,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/transfer_label" + android:contentDescription="@string/transfer" + android:onClick="@{ClipboardUtils::copyTextView}" android:visibility="gone" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/transfer_label" diff --git a/ui/src/main/res/values-de/strings.xml b/ui/src/main/res/values-de/strings.xml index 61407b9a..e84f0d42 100644 --- a/ui/src/main/res/values-de/strings.xml +++ b/ui/src/main/res/values-de/strings.xml @@ -134,7 +134,6 @@ <string name="pre_shared_key">Vorab geteilter Schlüssel</string> <string name="private_key">Privater Schlüssel</string> <string name="public_key">Öffentlicher Schlüssel</string> - <string name="public_key_description">Öffentlicher Schlüssel</string> <string name="qr_code_hint">Tipp: Mit `qrencode -t ansiutf8 < tunnel.conf` generieren.</string> <string name="restore_on_boot_summary_off">Wird aktivierte Tunnel beim Systemstart nicht automatisch starten</string> <string name="restore_on_boot_summary_on">Wird aktivierte Tunnel beim Systemstart automatisch wieder starten</string> diff --git a/ui/src/main/res/values-hi/strings.xml b/ui/src/main/res/values-hi/strings.xml index 19d970b8..fa65c119 100644 --- a/ui/src/main/res/values-hi/strings.xml +++ b/ui/src/main/res/values-hi/strings.xml @@ -120,7 +120,6 @@ <string name="pre_shared_key">प्री-शेयर्ड कीस</string> <string name="private_key">निजी कीस</string> <string name="public_key">सार्वजनिक कीस</string> - <string name="public_key_description">सार्वजनिक कीस</string> <string name="qr_code_hint">सुझाव: `qrencode -t ansiutf8 < tunnel.conf` के साथ उत्पन्न करो</string> <string name="restore_on_boot_summary_on">बूट पर सक्षम टनलस को लाएगा</string> <string name="restore_on_boot_summary_off">बूट पर सक्षम टनलस को नहीं लाएगा</string> diff --git a/ui/src/main/res/values-id/strings.xml b/ui/src/main/res/values-id/strings.xml index ca3ba316..866e7ed4 100644 --- a/ui/src/main/res/values-id/strings.xml +++ b/ui/src/main/res/values-id/strings.xml @@ -128,7 +128,6 @@ <string name="pre_shared_key">Kunci Pra-bersama</string> <string name="private_key">Kunci pribadi</string> <string name="public_key">Kunci publik</string> - <string name="public_key_description">Kunci publik</string> <string name="qr_code_hint">Tips: generate dengan `qrencode -t ansiutf8 < tunnel.conf`.</string> <string name="restore_on_boot_summary_off">Tunel yang diaktifkan tidak akan ditampilkan saat boot</string> <string name="restore_on_boot_summary_on">Tunel yang diaktifkan akan dimunculkan saat boot</string> diff --git a/ui/src/main/res/values-it/strings.xml b/ui/src/main/res/values-it/strings.xml index 0abd3c3a..61e6186a 100644 --- a/ui/src/main/res/values-it/strings.xml +++ b/ui/src/main/res/values-it/strings.xml @@ -134,7 +134,6 @@ <string name="pre_shared_key">Chiave condivisa (PSK)</string> <string name="private_key">Chiave privata</string> <string name="public_key">Chiave pubblica</string> - <string name="public_key_description">La chiave pubblica</string> <string name="qr_code_hint">Suggerimento: genera con `qrencode -t ansiutf8 < tunnel.conf`.</string> <string name="restore_on_boot_summary_off">Non attiverà i tunnel configurati all\'avvio</string> <string name="restore_on_boot_summary_on">Attiverà i tunnel configurati all\'avvio</string> diff --git a/ui/src/main/res/values-ja/strings.xml b/ui/src/main/res/values-ja/strings.xml index f8054ab2..fff388f7 100644 --- a/ui/src/main/res/values-ja/strings.xml +++ b/ui/src/main/res/values-ja/strings.xml @@ -128,7 +128,6 @@ <string name="pre_shared_key">事前共有鍵</string> <string name="private_key">秘密鍵</string> <string name="public_key">公開鍵</string> - <string name="public_key_description">公開鍵</string> <string name="qr_code_hint">Tip: `qrencode -t ansiutf8 < tunnel.conf` で生成できます</string> <string name="restore_on_boot_summary_off">起動時にトンネルを有効化しない</string> <string name="restore_on_boot_summary_on">起動時に、前回有効だったトンネルを有効化する</string> diff --git a/ui/src/main/res/values-ru/strings.xml b/ui/src/main/res/values-ru/strings.xml index 5f9927a0..dfa0904e 100644 --- a/ui/src/main/res/values-ru/strings.xml +++ b/ui/src/main/res/values-ru/strings.xml @@ -146,7 +146,6 @@ <string name="pre_shared_key">Общий ключ</string> <string name="private_key">Приватный ключ</string> <string name="public_key">Публичный ключ</string> - <string name="public_key_description">Публичный ключ</string> <string name="qr_code_hint">Совет: генерировать с `qrencode -t ansiutf8 < tunnel.conf`.</string> <string name="restore_on_boot_summary_off">Не поднимать ранее выбранные туннели при загрузке</string> <string name="restore_on_boot_summary_on">Поднимать ранее выбранные туннели при загрузке</string> diff --git a/ui/src/main/res/values-sl/strings.xml b/ui/src/main/res/values-sl/strings.xml index 4aa1dce6..7befe6ba 100644 --- a/ui/src/main/res/values-sl/strings.xml +++ b/ui/src/main/res/values-sl/strings.xml @@ -146,7 +146,6 @@ <string name="pre_shared_key">Vnaprej deljen ključ</string> <string name="private_key">Privatni ključ</string> <string name="public_key">Javni ključ</string> - <string name="public_key_description">Javni ključ</string> <string name="qr_code_hint">Namig: Generirajte z `qrencode -t ansiutf8 < tunnel.conf`.</string> <string name="restore_on_boot_summary_off">Pri vklopu telefona, aktivirani tuneli ne bodo avtimatično vzpostavljeni</string> <string name="restore_on_boot_summary_on">Pri vklopu telefona bodo aktivirani tuneli avtimatično vzpostavljeni</string> diff --git a/ui/src/main/res/values-zh-rCN/strings.xml b/ui/src/main/res/values-zh-rCN/strings.xml index ca4e8fcd..91753ce4 100644 --- a/ui/src/main/res/values-zh-rCN/strings.xml +++ b/ui/src/main/res/values-zh-rCN/strings.xml @@ -128,7 +128,6 @@ <string name="pre_shared_key">预共享密钥</string> <string name="private_key">私钥</string> <string name="public_key">公钥</string> - <string name="public_key_description">公钥</string> <string name="qr_code_hint">提示:使用命令 `qrencode -t ansiutf8 < tunnel.conf` 生成二维码</string> <string name="restore_on_boot_summary_off">未启用</string> <string name="restore_on_boot_summary_on">设备启动时自动开启上次使用的隧道</string> diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index e47bd9b8..41bb31ac 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -39,6 +39,10 @@ <item quantity="one">Exclude %d app</item> <item quantity="other">Exclude %d apps</item> </plurals> + <plurals name="persistent_keepalive_seconds_unit"> + <item quantity="one">every second</item> + <item quantity="other">every %d seconds</item> + </plurals> <string name="use_all_applications">Use all apps</string> <string name="add_peer">Add peer</string> <string name="addresses">Addresses</string> @@ -148,9 +152,9 @@ <string name="permission_label">control WireGuard tunnels</string> <string name="persistent_keepalive">Persistent keepalive</string> <string name="pre_shared_key">Pre-shared key</string> + <string name="pre_shared_key_enabled">enabled</string> <string name="private_key">Private key</string> <string name="public_key">Public key</string> - <string name="public_key_description">Public key</string> <string name="qr_code_hint">Tip: generate with `qrencode -t ansiutf8 < tunnel.conf`.</string> <string name="restore_on_boot_summary_off">Will not bring up enabled tunnels at boot</string> <string name="restore_on_boot_summary_on">Will bring up enabled tunnels at boot</string> |