Finish first pass of config editor fields
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
3a264f7020
commit
c1cdea42b6
@ -21,7 +21,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".AddActivity"
|
android:name=".AddActivity"
|
||||||
android:label="@string/edit_activity_title" />
|
android:label="@string/add_activity_title" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SettingsActivity"
|
android:name=".SettingsActivity"
|
||||||
android:label="@string/settings">
|
android:label="@string/settings">
|
||||||
|
9
app/src/main/res/drawable/ic_action_delete_black.xml
Normal file
9
app/src/main/res/drawable/ic_action_delete_black.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
@ -17,15 +17,11 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:background="?android:attr/colorPrimary"
|
|
||||||
android:paddingEnd="0dp"
|
|
||||||
android:paddingStart="4dp"
|
|
||||||
tools:ignore="InconsistentLayout">
|
tools:ignore="InconsistentLayout">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?android:attr/colorBackground"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/placeholder_text" />
|
android:text="@string/placeholder_text" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/master_fragment"
|
android:id="@+id/master_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
tools:ignore="MergeRootFrame" />
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
<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>
|
<data>
|
||||||
|
|
||||||
@ -13,43 +15,72 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?android:attr/colorBackground">
|
android:background="?android:attr/colorBackground">
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="16dp">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/status_label"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_marginBottom="4dp"
|
||||||
android:text="@string/status" />
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="?android:attr/colorBackground"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/status_text"
|
android:id="@+id/status_label"
|
||||||
style="?android:attr/textAppearanceMedium"
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text="@string/status" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/status_text"
|
||||||
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBaseline="@+id/status_label"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_toEndOf="@+id/status_label"
|
||||||
|
android:gravity="end"
|
||||||
|
android:text="@{config.enabled ? @string/enabled : @string/disabled}"
|
||||||
|
android:textColor="@{config.enabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/public_key_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/status_label"
|
||||||
|
android:labelFor="@+id/public_key_text"
|
||||||
|
android:text="@string/public_key" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/public_key_text"
|
||||||
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/public_key_label"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@{config.interface.publicKey}" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/status_label"
|
android:layout_marginBottom="4dp"
|
||||||
android:text="@{config.enabled ? @string/enabled : @string/disabled}" />
|
android:divider="@null"
|
||||||
|
android:orientation="vertical"
|
||||||
<TextView
|
app:items="@{config.peers}"
|
||||||
android:id="@+id/public_key_label"
|
app:layout="@{@layout/config_detail_peer}"
|
||||||
android:layout_width="match_parent"
|
tools:ignore="UselessLeaf" />
|
||||||
android:layout_height="wrap_content"
|
</LinearLayout>
|
||||||
android:layout_below="@id/status_text"
|
|
||||||
android:labelFor="@+id/public_key_text"
|
|
||||||
android:text="@string/public_key" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/public_key_text"
|
|
||||||
style="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/public_key_label"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@{config.interface.publicKey}" />
|
|
||||||
</RelativeLayout>
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</layout>
|
</layout>
|
||||||
|
81
app/src/main/res/layout/config_detail_peer.xml
Normal file
81
app/src/main/res/layout/config_detail_peer.xml
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="item"
|
||||||
|
type="com.wireguard.config.Peer" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<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="4dp"
|
||||||
|
android:background="?android:attr/colorBackground"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/peer_title"
|
||||||
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text="@string/peer" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/public_key_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/peer_title"
|
||||||
|
android:labelFor="@+id/public_key_text"
|
||||||
|
android:text="@string/public_key" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/public_key_text"
|
||||||
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/public_key_label"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@{item.publicKey}" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/allowed_ips_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/public_key_text"
|
||||||
|
android:labelFor="@+id/allowed_ips_text"
|
||||||
|
android:text="@string/allowed_ips" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/allowed_ips_text"
|
||||||
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/allowed_ips_label"
|
||||||
|
android:text="@{item.allowedIPs}" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/endpoint_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/allowed_ips_text"
|
||||||
|
android:labelFor="@+id/endpoint_text"
|
||||||
|
android:text="@string/endpoint" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/endpoint_text"
|
||||||
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/endpoint_label"
|
||||||
|
android:text="@{item.endpoint}" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</layout>
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
@ -18,149 +19,198 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?android:attr/colorBackground">
|
android:background="?android:attr/colorBackground">
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="16dp">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/config_name_label"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_marginBottom="4dp"
|
||||||
android:labelFor="@+id/config_name_text"
|
android:layout_marginEnd="8dp"
|
||||||
android:text="@string/config_name" />
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="?android:attr/colorBackground"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:id="@+id/config_name_text"
|
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: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="textCapWords"
|
||||||
|
android:text="@={config.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: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: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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/config_name_label"
|
android:divider="@null"
|
||||||
android:inputType="textCapWords"
|
android:orientation="vertical"
|
||||||
android:text="@={config.name}"
|
app:items="@{config.peers}"
|
||||||
app:filter="@{NameInputFilter.newInstance()}" />
|
app:layout="@{@layout/config_edit_peer}"
|
||||||
|
tools:ignore="UselessLeaf" />
|
||||||
<TextView
|
|
||||||
android:id="@+id/private_key_label"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/config_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:inputType="textVisiblePassword"
|
|
||||||
android:text="@={config.interface.privateKey}"
|
|
||||||
app:filter="@{KeyInputFilter.newInstance()}" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/generate_private_key_button"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@id/private_key_text"
|
android:layout_marginBottom="4dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_marginEnd="4dp"
|
||||||
android:layout_below="@+id/private_key_label"
|
android:layout_marginStart="4dp"
|
||||||
android:onClick="@{() -> config.interface.generateKeypair()}"
|
android:onClick="@{() -> config.addPeer()}"
|
||||||
android:text="@string/generate" />
|
android:text="@string/add_peer" />
|
||||||
|
</LinearLayout>
|
||||||
<TextView
|
|
||||||
android:id="@+id/public_key_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_below="@+id/private_key_text"
|
|
||||||
android:layout_toStartOf="@+id/listen_port_label"
|
|
||||||
android:labelFor="@+id/public_key_text"
|
|
||||||
android:text="@string/public_key" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/public_key_text"
|
|
||||||
style="@android:style/Widget.EditText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_below="@+id/public_key_label"
|
|
||||||
android:layout_toStartOf="@+id/listen_port_text"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:focusable="false"
|
|
||||||
android:hint="@string/hint_generated"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@{config.interface.publicKey}" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/listen_port_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignBaseline="@+id/public_key_label"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignStart="@+id/generate_private_key_button"
|
|
||||||
android:layout_below="@+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/public_key_text"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignStart="@+id/generate_private_key_button"
|
|
||||||
android:layout_below="@+id/listen_port_label"
|
|
||||||
android:hint="@string/hint_random"
|
|
||||||
android:inputType="number"
|
|
||||||
android:text="@={config.interface.listenPort}"
|
|
||||||
android:textAlignment="center" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/dns_server_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/mtu_label"
|
|
||||||
android:labelFor="@+id/dns_server_text"
|
|
||||||
android:text="@string/dns_servers" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/dns_server_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_below="@+id/dns_server_label"
|
|
||||||
android:layout_toStartOf="@+id/mtu_text"
|
|
||||||
android:hint="@string/hint_optional"
|
|
||||||
android:inputType="text"
|
|
||||||
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_server_label"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignStart="@+id/generate_private_key_button"
|
|
||||||
android:layout_below="@+id/listen_port_text"
|
|
||||||
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_server_text"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignStart="@+id/generate_private_key_button"
|
|
||||||
android:layout_below="@+id/mtu_label"
|
|
||||||
android:hint="@string/hint_automatic"
|
|
||||||
android:inputType="number"
|
|
||||||
android:text="@={config.interface.mtu}"
|
|
||||||
android:textAlignment="center" />
|
|
||||||
</RelativeLayout>
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</layout>
|
</layout>
|
||||||
|
120
app/src/main/res/layout/config_edit_peer.xml
Normal file
120
app/src/main/res/layout/config_edit_peer.xml
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<import type="com.wireguard.android.KeyInputFilter" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="item"
|
||||||
|
type="com.wireguard.config.Peer" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<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="4dp"
|
||||||
|
android:background="?android:attr/colorBackground"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/peer_title"
|
||||||
|
style="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_toStartOf="@+id/peer_action_delete"
|
||||||
|
android:text="@string/peer" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/peer_action_delete"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:background="@null"
|
||||||
|
android:contentDescription="@string/delete"
|
||||||
|
android:onClick="@{() -> item.removeSelf()}"
|
||||||
|
android:src="@drawable/ic_action_delete_black" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/public_key_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/peer_title"
|
||||||
|
android:labelFor="@+id/public_key_text"
|
||||||
|
android:text="@string/public_key" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/public_key_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/public_key_label"
|
||||||
|
android:inputType="textVisiblePassword"
|
||||||
|
android:text="@={item.publicKey}"
|
||||||
|
app:filter="@{KeyInputFilter.newInstance()}" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/allowed_ips_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/public_key_text"
|
||||||
|
android:labelFor="@+id/allowed_ips_text"
|
||||||
|
android:text="@string/allowed_ips" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/allowed_ips_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/allowed_ips_label"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:text="@={item.allowedIPs}" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/endpoint_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_below="@+id/allowed_ips_text"
|
||||||
|
android:layout_toStartOf="@+id/persistent_keepalive_label"
|
||||||
|
android:labelFor="@+id/endpoint_text"
|
||||||
|
android:text="@string/endpoint" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/endpoint_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_below="@+id/endpoint_label"
|
||||||
|
android:layout_toStartOf="@+id/persistent_keepalive_text"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:text="@={item.endpoint}" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/persistent_keepalive_label"
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBaseline="@+id/endpoint_label"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:labelFor="@+id/persistent_keepalive_text"
|
||||||
|
android:text="@string/persistent_keepalive" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/persistent_keepalive_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBaseline="@+id/endpoint_text"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignStart="@+id/persistent_keepalive_label"
|
||||||
|
android:inputType="number"
|
||||||
|
android:text="@={item.persistentKeepalive}"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</layout>
|
@ -5,22 +5,28 @@
|
|||||||
<item quantity="other">%d configurations selected</item>
|
<item quantity="other">%d configurations selected</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="add">Add</string>
|
<string name="add">Add</string>
|
||||||
|
<string name="add_activity_title">New WireGuard configuration</string>
|
||||||
|
<string name="add_peer">Add peer</string>
|
||||||
|
<string name="addresses">Addresses</string>
|
||||||
|
<string name="allowed_ips">Allowed IPs</string>
|
||||||
<string name="app_name">WireGuard</string>
|
<string name="app_name">WireGuard</string>
|
||||||
<string name="config_name">Configuration name</string>
|
|
||||||
<string name="delete">Delete</string>
|
<string name="delete">Delete</string>
|
||||||
<string name="disabled">Disabled</string>
|
<string name="disabled">Disabled</string>
|
||||||
<string name="dns_servers">DNS servers</string>
|
<string name="dns_servers">DNS servers</string>
|
||||||
<string name="edit">Edit</string>
|
<string name="edit">Edit</string>
|
||||||
<string name="edit_activity_title">Add WireGuard Configuration</string>
|
|
||||||
<string name="enabled">Enabled</string>
|
<string name="enabled">Enabled</string>
|
||||||
|
<string name="endpoint">Endpoint</string>
|
||||||
<string name="generate">Generate</string>
|
<string name="generate">Generate</string>
|
||||||
<string name="hint_automatic">(auto)</string>
|
<string name="hint_automatic">(auto)</string>
|
||||||
<string name="hint_generated">(generated)</string>
|
<string name="hint_generated">(generated)</string>
|
||||||
<string name="hint_optional">(optional)</string>
|
|
||||||
<string name="hint_random">(random)</string>
|
<string name="hint_random">(random)</string>
|
||||||
|
<string name="iface">Interface</string>
|
||||||
<string name="listen_port">Listen port</string>
|
<string name="listen_port">Listen port</string>
|
||||||
<string name="loading">Loading</string>
|
<string name="loading">Loading</string>
|
||||||
<string name="mtu">MTU</string>
|
<string name="mtu">MTU</string>
|
||||||
|
<string name="name">Name</string>
|
||||||
|
<string name="peer">Peer</string>
|
||||||
|
<string name="persistent_keepalive">Persistent keepalive</string>
|
||||||
<string name="placeholder_text">No configuration selected</string>
|
<string name="placeholder_text">No configuration selected</string>
|
||||||
<string name="primary_config">Primary configuration</string>
|
<string name="primary_config">Primary configuration</string>
|
||||||
<string name="primary_config_summary">This configuration will be controlled by the quick settings tile</string>
|
<string name="primary_config_summary">This configuration will be controlled by the quick settings tile</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user