aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-22 23:09:55 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-22 23:10:41 -0500
commitc1cdea42b6261008596d6924dcc488aef289b0d2 (patch)
treec7da715b0a02ad993e588f535259d99a896fde1b /app/src/main
parentQuickTileService: Update the tile once on service init (diff)
downloadwireguard-android-c1cdea42b6261008596d6924dcc488aef289b0d2.tar.xz
wireguard-android-c1cdea42b6261008596d6924dcc488aef289b0d2.zip
Finish first pass of config editor fields
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml2
-rw-r--r--app/src/main/res/drawable/ic_action_delete_black.xml9
-rw-r--r--app/src/main/res/layout-land/config_activity.xml4
-rw-r--r--app/src/main/res/layout/config_activity.xml4
-rw-r--r--app/src/main/res/layout/config_detail_fragment.xml89
-rw-r--r--app/src/main/res/layout/config_detail_peer.xml81
-rw-r--r--app/src/main/res/layout/config_edit_fragment.xml320
-rw-r--r--app/src/main/res/layout/config_edit_peer.xml120
-rw-r--r--app/src/main/res/values/strings.xml12
9 files changed, 468 insertions, 173 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index fef6f59d..4dfad4fa 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -21,7 +21,7 @@
</activity>
<activity
android:name=".AddActivity"
- android:label="@string/edit_activity_title" />
+ android:label="@string/add_activity_title" />
<activity
android:name=".SettingsActivity"
android:label="@string/settings">
diff --git a/app/src/main/res/drawable/ic_action_delete_black.xml b/app/src/main/res/drawable/ic_action_delete_black.xml
new file mode 100644
index 00000000..c3e906d5
--- /dev/null
+++ b/app/src/main/res/drawable/ic_action_delete_black.xml
@@ -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>
diff --git a/app/src/main/res/layout-land/config_activity.xml b/app/src/main/res/layout-land/config_activity.xml
index aa310a43..72792af5 100644
--- a/app/src/main/res/layout-land/config_activity.xml
+++ b/app/src/main/res/layout-land/config_activity.xml
@@ -17,15 +17,11 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
- android:background="?android:attr/colorPrimary"
- android:paddingEnd="0dp"
- android:paddingStart="4dp"
tools:ignore="InconsistentLayout">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?android:attr/colorBackground"
android:gravity="center"
android:text="@string/placeholder_text" />
</FrameLayout>
diff --git a/app/src/main/res/layout/config_activity.xml b/app/src/main/res/layout/config_activity.xml
index d67e64bc..0f21e2e8 100644
--- a/app/src/main/res/layout/config_activity.xml
+++ b/app/src/main/res/layout/config_activity.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/master_fragment"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ tools:ignore="MergeRootFrame" />
diff --git a/app/src/main/res/layout/config_detail_fragment.xml b/app/src/main/res/layout/config_detail_fragment.xml
index b229e568..206263dc 100644
--- a/app/src/main/res/layout/config_detail_fragment.xml
+++ b/app/src/main/res/layout/config_detail_fragment.xml
@@ -1,5 +1,7 @@
<?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>
@@ -13,43 +15,72 @@
android:layout_height="match_parent"
android:background="?android:attr/colorBackground">
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="16dp">
+ android:orientation="vertical">
- <TextView
- android:id="@+id/status_label"
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:text="@string/status" />
+ 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/status_text"
- style="?android:attr/textAppearanceMedium"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/status_label"
- android:text="@{config.enabled ? @string/enabled : @string/disabled}" />
+ <TextView
+ android:id="@+id/status_label"
+ 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/public_key_label"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/status_text"
- android:labelFor="@+id/public_key_text"
- android:text="@string/public_key" />
+ <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>
- <TextView
- android:id="@+id/public_key_text"
- style="?android:attr/textAppearanceMedium"
+ <LinearLayout
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>
+ android:layout_marginBottom="4dp"
+ android:divider="@null"
+ android:orientation="vertical"
+ app:items="@{config.peers}"
+ app:layout="@{@layout/config_detail_peer}"
+ tools:ignore="UselessLeaf" />
+ </LinearLayout>
</ScrollView>
</layout>
diff --git a/app/src/main/res/layout/config_detail_peer.xml b/app/src/main/res/layout/config_detail_peer.xml
new file mode 100644
index 00000000..1bd1b333
--- /dev/null
+++ b/app/src/main/res/layout/config_detail_peer.xml
@@ -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>
diff --git a/app/src/main/res/layout/config_edit_fragment.xml b/app/src/main/res/layout/config_edit_fragment.xml
index fa936517..86045324 100644
--- a/app/src/main/res/layout/config_edit_fragment.xml
+++ b/app/src/main/res/layout/config_edit_fragment.xml
@@ -1,6 +1,7 @@
<?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:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools">
<data>
@@ -18,149 +19,198 @@
android:layout_height="match_parent"
android:background="?android:attr/colorBackground">
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="16dp">
+ android:orientation="vertical">
- <TextView
- android:id="@+id/config_name_label"
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:labelFor="@+id/config_name_text"
- android:text="@string/config_name" />
-
- <EditText
- android:id="@+id/config_name_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/config_name_label"
- android:inputType="textCapWords"
- android:text="@={config.name}"
- app:filter="@{NameInputFilter.newInstance()}" />
-
- <TextView
- android:id="@+id/private_key_label"
+ 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: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_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()}" />
+ android:divider="@null"
+ android:orientation="vertical"
+ app:items="@{config.peers}"
+ app:layout="@{@layout/config_edit_peer}"
+ tools:ignore="UselessLeaf" />
<Button
- android:id="@+id/generate_private_key_button"
- android:layout_width="wrap_content"
- 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="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_width="match_parent"
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>
+ android:layout_marginBottom="4dp"
+ android:layout_marginEnd="4dp"
+ android:layout_marginStart="4dp"
+ android:onClick="@{() -> config.addPeer()}"
+ android:text="@string/add_peer" />
+ </LinearLayout>
</ScrollView>
</layout>
diff --git a/app/src/main/res/layout/config_edit_peer.xml b/app/src/main/res/layout/config_edit_peer.xml
new file mode 100644
index 00000000..6bb13047
--- /dev/null
+++ b/app/src/main/res/layout/config_edit_peer.xml
@@ -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>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9397dcf3..7c707f11 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,22 +5,28 @@
<item quantity="other">%d configurations selected</item>
</plurals>
<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="config_name">Configuration name</string>
<string name="delete">Delete</string>
<string name="disabled">Disabled</string>
<string name="dns_servers">DNS servers</string>
<string name="edit">Edit</string>
- <string name="edit_activity_title">Add WireGuard Configuration</string>
<string name="enabled">Enabled</string>
+ <string name="endpoint">Endpoint</string>
<string name="generate">Generate</string>
<string name="hint_automatic">(auto)</string>
<string name="hint_generated">(generated)</string>
- <string name="hint_optional">(optional)</string>
<string name="hint_random">(random)</string>
+ <string name="iface">Interface</string>
<string name="listen_port">Listen port</string>
<string name="loading">Loading</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="primary_config">Primary configuration</string>
<string name="primary_config_summary">This configuration will be controlled by the quick settings tile</string>