diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-06 18:09:03 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-06 18:09:03 -0600 |
commit | 77b5937fbb8490b368acac85f434113a175f1bba (patch) | |
tree | 84ed0b11682f0d87be3edd20cceb1acae52b0123 /ui/src/main/res/layout | |
parent | 3144d360569cb358fc750733ccb180d3e9d2bc48 (diff) |
ui: add missing fields to detail view
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/res/layout')
-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 |
2 files changed, 142 insertions, 4 deletions
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" |