321 lines
18 KiB
XML
321 lines
18 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
xmlns:tools="http://schemas.android.com/tools">
|
|
|
|
<data>
|
|
|
|
<import type="com.wireguard.android.backend.Tunnel.State" />
|
|
|
|
<import type="com.wireguard.android.util.ClipboardUtils" />
|
|
|
|
<variable
|
|
name="fragment"
|
|
type="com.wireguard.android.fragment.TunnelDetailFragment" />
|
|
|
|
<variable
|
|
name="tunnel"
|
|
type="com.wireguard.android.model.ObservableTunnel" />
|
|
|
|
<variable
|
|
name="config"
|
|
type="com.wireguard.config.Config" />
|
|
</data>
|
|
|
|
<ScrollView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:background="?attr/colorSurface"
|
|
android:clickable="true"
|
|
android:focusable="true">
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content">
|
|
|
|
<com.google.android.material.card.MaterialCardView
|
|
android:id="@+id/tunnel_detail_card"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginStart="8dp"
|
|
android:layout_marginTop="16dp"
|
|
android:layout_marginEnd="8dp"
|
|
android:layout_marginBottom="8dp"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent">
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content">
|
|
|
|
<com.google.android.material.textview.MaterialTextView
|
|
android:id="@+id/interface_title"
|
|
style="@style/SectionText"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="@string/interface_title"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<com.wireguard.android.widget.ToggleSwitch
|
|
android:id="@+id/tunnel_switch"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="16dp"
|
|
android:nextFocusDown="@id/interface_name_text"
|
|
android:nextFocusForward="@id/interface_name_text"
|
|
app:checked="@{tunnel.state == State.UP}"
|
|
app:layout_constraintBaseline_toBottomOf="@+id/interface_title"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:onBeforeCheckedChanged="@{fragment::setTunnelState}" />
|
|
|
|
<TextView
|
|
android:id="@+id/interface_name_label"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="8dp"
|
|
android:labelFor="@+id/interface_name_text"
|
|
android:text="@string/name"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@+id/interface_title" />
|
|
|
|
<TextView
|
|
android:id="@+id/interface_name_text"
|
|
style="@style/DetailText"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:contentDescription="@string/name"
|
|
android:nextFocusUp="@id/tunnel_switch"
|
|
android:nextFocusDown="@id/public_key_text"
|
|
android:nextFocusForward="@id/public_key_text"
|
|
android:onClick="@{ClipboardUtils::copyTextView}"
|
|
android:text="@{tunnel.name}"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@+id/interface_name_label"
|
|
tools:text="wg0" />
|
|
|
|
<TextView
|
|
android:id="@+id/public_key_label"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="8dp"
|
|
android:labelFor="@+id/public_key_text"
|
|
android:text="@string/public_key"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@id/interface_name_text" />
|
|
|
|
<TextView
|
|
android:id="@+id/public_key_text"
|
|
style="@style/DetailText"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:contentDescription="@string/public_key"
|
|
android:ellipsize="end"
|
|
android:maxLines="1"
|
|
android:nextFocusUp="@id/interface_name_text"
|
|
android:nextFocusDown="@id/addresses_text"
|
|
android:nextFocusForward="@id/addresses_text"
|
|
android:onClick="@{ClipboardUtils::copyTextView}"
|
|
android:singleLine="true"
|
|
android:text="@{config.interface.keyPair.publicKey.toBase64}"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@+id/public_key_label"
|
|
tools:text="wOs2eguFEohqIZxlSJ1CAT9584tc6ejj9hfGFsoBVkA=" />
|
|
|
|
<TextView
|
|
android:id="@+id/addresses_label"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
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" />
|
|
|
|
<TextView
|
|
android:id="@+id/addresses_text"
|
|
style="@style/DetailText"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:contentDescription="@string/addresses"
|
|
android:nextFocusUp="@id/public_key_text"
|
|
android:nextFocusDown="@id/dns_servers_text"
|
|
android:nextFocusForward="@id/dns_servers_text"
|
|
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:nextFocusUp="@id/addresses_text"
|
|
android:nextFocusDown="@id/dns_search_domains_text"
|
|
android:nextFocusForward="@id/dns_search_domains_text"
|
|
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/dns_search_domains_label"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="8dp"
|
|
android:labelFor="@+id/dns_search_domain_text"
|
|
android:text="@string/dns_search_domains"
|
|
android:visibility="@{config.interface.dnsSearchDomains.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/dns_search_domains_text"
|
|
style="@style/DetailText"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:contentDescription="@string/dns_search_domains"
|
|
android:nextFocusUp="@id/dns_servers_text"
|
|
android:nextFocusDown="@id/listen_port_text"
|
|
android:nextFocusForward="@id/listen_port_text"
|
|
android:onClick="@{ClipboardUtils::copyTextView}"
|
|
android:text="@{config.interface.dnsSearchDomains}"
|
|
android:visibility="@{config.interface.dnsSearchDomains.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@+id/dns_search_domains_label"
|
|
tools:text="zx2c4.com" />
|
|
|
|
<TextView
|
|
android:id="@+id/listen_port_label"
|
|
android:layout_width="0dp"
|
|
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.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
|
|
app:layout_constraintEnd_toStartOf="@id/mtu_label"
|
|
app:layout_constraintHorizontal_weight="0.5"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@id/dns_search_domains_text" />
|
|
|
|
<TextView
|
|
android:id="@+id/listen_port_text"
|
|
style="@style/DetailText"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:contentDescription="@string/listen_port"
|
|
android:nextFocusRight="@id/mtu_text"
|
|
android:nextFocusUp="@id/dns_search_domains_text"
|
|
android:nextFocusDown="@id/applications_text"
|
|
android:nextFocusForward="@id/mtu_text"
|
|
android:onClick="@{ClipboardUtils::copyTextView}"
|
|
android:text="@{config.interface.listenPort}"
|
|
android:visibility="@{!config.interface.listenPort.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
|
|
app:layout_constraintEnd_toStartOf="@id/mtu_label"
|
|
app:layout_constraintHorizontal_weight="0.5"
|
|
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="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="8dp"
|
|
android:labelFor="@+id/mtu_text"
|
|
android:text="@string/mtu"
|
|
android:visibility="@{!config.interface.mtu.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintHorizontal_weight="0.5"
|
|
app:layout_constraintLeft_toRightOf="@id/listen_port_label"
|
|
app:layout_constraintStart_toEndOf="@id/listen_port_label"
|
|
app:layout_constraintTop_toBottomOf="@id/dns_search_domains_text" />
|
|
|
|
<TextView
|
|
android:id="@+id/mtu_text"
|
|
style="@style/DetailText"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:contentDescription="@string/mtu"
|
|
android:nextFocusLeft="@id/listen_port_text"
|
|
android:nextFocusUp="@id/dns_servers_text"
|
|
android:nextFocusForward="@id/applications_text"
|
|
android:onClick="@{ClipboardUtils::copyTextView}"
|
|
android:text="@{config.interface.mtu}"
|
|
android:visibility="@{!config.interface.mtu.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintHorizontal_weight="0.5"
|
|
app:layout_constraintStart_toEndOf="@id/listen_port_label"
|
|
app:layout_constraintStart_toStartOf="@+id/mtu_label"
|
|
app:layout_constraintTop_toBottomOf="@+id/mtu_label"
|
|
tools:text="1500" />
|
|
|
|
<androidx.constraintlayout.widget.Barrier
|
|
android:id="@+id/listen_port_mtu_barrier"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
app:barrierDirection="bottom"
|
|
app:constraint_referenced_ids="listen_port_text,mtu_text" />
|
|
|
|
<TextView
|
|
android:id="@+id/applications_label"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="8dp"
|
|
android:labelFor="@+id/applications_text"
|
|
android:text="@string/applications"
|
|
android:visibility="@{config.interface.includedApplications.isEmpty() && config.interface.excludedApplications.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}"
|
|
app:layout_constraintTop_toBottomOf="@+id/listen_port_mtu_barrier"
|
|
app:layout_constraintStart_toStartOf="parent" />
|
|
|
|
<TextView
|
|
android:id="@+id/applications_text"
|
|
style="@style/DetailText"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:contentDescription="@string/applications"
|
|
android:nextFocusUp="@id/mtu_text"
|
|
android:nextFocusDown="@id/peers_layout"
|
|
android:nextFocusForward="@id/peers_layout"
|
|
android:onClick="@{ClipboardUtils::copyTextView}"
|
|
android:text="@{config.interface.includedApplications.isEmpty() ? @plurals/n_excluded_applications(config.interface.excludedApplications.size(), config.interface.excludedApplications.size()) : @plurals/n_included_applications(config.interface.includedApplications.size(), config.interface.includedApplications.size())}"
|
|
android:visibility="@{config.interface.includedApplications.isEmpty() && config.interface.excludedApplications.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}"
|
|
app:layout_constraintTop_toBottomOf="@+id/applications_label"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
tools:text="8 excluded" />
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
</com.google.android.material.card.MaterialCardView>
|
|
|
|
<LinearLayout
|
|
android:id="@+id/peers_layout"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="8dp"
|
|
android:divider="@null"
|
|
android:orientation="vertical"
|
|
app:items="@{config.peers}"
|
|
app:layout="@{@layout/tunnel_detail_peer}"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@+id/tunnel_detail_card"
|
|
tools:ignore="UselessLeaf" />
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
</ScrollView>
|
|
</layout> |