234 lines
11 KiB
XML
234 lines
11 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.util.ClipboardUtils" />
|
||
|
|
||
|
<import type="com.wireguard.android.widget.KeyInputFilter" />
|
||
|
|
||
|
<import type="com.wireguard.android.widget.NameInputFilter" />
|
||
|
|
||
|
<import type="com.wireguard.config.Peer" />
|
||
|
|
||
|
<variable
|
||
|
name="config"
|
||
|
type="com.wireguard.config.Config" />
|
||
|
|
||
|
<variable
|
||
|
name="name"
|
||
|
type="android.databinding.ObservableField<String>" />
|
||
|
</data>
|
||
|
|
||
|
<com.commonsware.cwac.crossport.design.widget.CoordinatorLayout
|
||
|
android:id="@+id/main_container"
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="match_parent"
|
||
|
android:background="?android:attr/colorBackground">
|
||
|
|
||
|
<ScrollView
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="match_parent">
|
||
|
|
||
|
<LinearLayout
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:orientation="vertical">
|
||
|
|
||
|
<RelativeLayout
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_marginBottom="4dp"
|
||
|
android:layout_marginEnd="8dp"
|
||
|
android:layout_marginStart="8dp"
|
||
|
android:layout_marginTop="8dp"
|
||
|
android:background="?android:attr/colorBackground"
|
||
|
android:elevation="2dp"
|
||
|
android:padding="8dp">
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/interface_title"
|
||
|
style="?android:attr/textAppearanceMedium"
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignParentTop="true"
|
||
|
android:text="@string/iface" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/interface_name_label"
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_below="@+id/interface_title"
|
||
|
android:layout_marginTop="8dp"
|
||
|
android:labelFor="@+id/interface_name_text"
|
||
|
android:text="@string/name" />
|
||
|
|
||
|
<EditText
|
||
|
android:id="@+id/interface_name_text"
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_below="@+id/interface_name_label"
|
||
|
android:inputType="textNoSuggestions"
|
||
|
android:text="@={name}"
|
||
|
app:filter="@{NameInputFilter.newInstance()}" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/private_key_label"
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_below="@+id/interface_name_text"
|
||
|
android:labelFor="@+id/private_key_text"
|
||
|
android:text="@string/private_key" />
|
||
|
|
||
|
<EditText
|
||
|
android:id="@+id/private_key_text"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignParentStart="true"
|
||
|
android:layout_below="@+id/private_key_label"
|
||
|
android:layout_toStartOf="@+id/generate_private_key_button"
|
||
|
android:contentDescription="@string/public_key_description"
|
||
|
android:inputType="textVisiblePassword"
|
||
|
android:text="@={config.interface.privateKey}"
|
||
|
app:filter="@{KeyInputFilter.newInstance()}" />
|
||
|
|
||
|
<Button
|
||
|
android:id="@+id/generate_private_key_button"
|
||
|
android:layout_width="96dp"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignBottom="@id/private_key_text"
|
||
|
android:layout_alignParentEnd="true"
|
||
|
android:layout_below="@+id/private_key_label"
|
||
|
android:onClick="@{() -> config.interface.generateKeypair()}"
|
||
|
android:text="@string/generate" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/public_key_label"
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_below="@+id/private_key_text"
|
||
|
android:labelFor="@+id/public_key_text"
|
||
|
android:text="@string/public_key" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/public_key_text"
|
||
|
style="?android:attr/editTextStyle"
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_below="@+id/public_key_label"
|
||
|
android:ellipsize="end"
|
||
|
android:focusable="false"
|
||
|
android:hint="@string/hint_generated"
|
||
|
android:maxLines="1"
|
||
|
android:onClick="@{ClipboardUtils::copyTextView}"
|
||
|
android:text="@{config.interface.publicKey}" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/addresses_label"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignParentStart="true"
|
||
|
android:layout_below="@+id/public_key_text"
|
||
|
android:layout_toStartOf="@+id/listen_port_label"
|
||
|
android:labelFor="@+id/addresses_text"
|
||
|
android:text="@string/addresses" />
|
||
|
|
||
|
<EditText
|
||
|
android:id="@+id/addresses_text"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignParentStart="true"
|
||
|
android:layout_below="@+id/addresses_label"
|
||
|
android:layout_toStartOf="@+id/listen_port_text"
|
||
|
android:inputType="textNoSuggestions"
|
||
|
android:text="@={config.interface.address}" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/listen_port_label"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignBaseline="@+id/addresses_label"
|
||
|
android:layout_alignParentEnd="true"
|
||
|
android:layout_alignStart="@+id/generate_private_key_button"
|
||
|
android:labelFor="@+id/listen_port_text"
|
||
|
android:text="@string/listen_port" />
|
||
|
|
||
|
<EditText
|
||
|
android:id="@+id/listen_port_text"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignBaseline="@+id/addresses_text"
|
||
|
android:layout_alignParentEnd="true"
|
||
|
android:layout_alignStart="@+id/generate_private_key_button"
|
||
|
android:hint="@string/hint_random"
|
||
|
android:inputType="number"
|
||
|
android:text="@={config.interface.listenPort}"
|
||
|
android:textAlignment="center" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/dns_servers_label"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignParentStart="true"
|
||
|
android:layout_below="@+id/addresses_text"
|
||
|
android:layout_toStartOf="@+id/mtu_label"
|
||
|
android:labelFor="@+id/dns_servers_text"
|
||
|
android:text="@string/dns_servers" />
|
||
|
|
||
|
<EditText
|
||
|
android:id="@+id/dns_servers_text"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignParentStart="true"
|
||
|
android:layout_below="@+id/dns_servers_label"
|
||
|
android:layout_toStartOf="@+id/mtu_text"
|
||
|
android:inputType="textNoSuggestions"
|
||
|
android:text="@={config.interface.dns}" />
|
||
|
|
||
|
<TextView
|
||
|
android:id="@+id/mtu_label"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignBaseline="@+id/dns_servers_label"
|
||
|
android:layout_alignParentEnd="true"
|
||
|
android:layout_alignStart="@+id/generate_private_key_button"
|
||
|
android:labelFor="@+id/mtu_text"
|
||
|
android:text="@string/mtu" />
|
||
|
|
||
|
<EditText
|
||
|
android:id="@+id/mtu_text"
|
||
|
android:layout_width="wrap_content"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_alignBaseline="@+id/dns_servers_text"
|
||
|
android:layout_alignParentEnd="true"
|
||
|
android:layout_alignStart="@+id/generate_private_key_button"
|
||
|
android:hint="@string/hint_automatic"
|
||
|
android:inputType="number"
|
||
|
android:text="@={config.interface.mtu}"
|
||
|
android:textAlignment="center" />
|
||
|
</RelativeLayout>
|
||
|
|
||
|
<LinearLayout
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:divider="@null"
|
||
|
android:orientation="vertical"
|
||
|
app:items="@{config.peers}"
|
||
|
app:layout="@{@layout/config_editor_peer}"
|
||
|
tools:ignore="UselessLeaf" />
|
||
|
|
||
|
<Button
|
||
|
android:layout_width="match_parent"
|
||
|
android:layout_height="wrap_content"
|
||
|
android:layout_marginBottom="4dp"
|
||
|
android:layout_marginEnd="4dp"
|
||
|
android:layout_marginStart="4dp"
|
||
|
android:onClick="@{() -> config.peers.add(Peer.newInstance())}"
|
||
|
android:text="@string/add_peer" />
|
||
|
</LinearLayout>
|
||
|
</ScrollView>
|
||
|
</com.commonsware.cwac.crossport.design.widget.CoordinatorLayout>
|
||
|
</layout>
|