summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/res
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-13 07:24:03 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-13 07:24:03 -0500
commit5e55d196be092f4a4dcb212cf09d7a1bdab70e00 (patch)
treeeb765a1b961fefdaa7ddc3cfae9cb83a09e0c031 /app/src/main/res
parentc72d30a1af8114ef506a137e3e7274ac33d82bd1 (diff)
Major renaming and refactoring in activity and service
Apparently "configuration" is the proper term, not "profile". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/layout-land/config_activity.xml (renamed from app/src/main/res/layout-land/profile_list_activity.xml)8
-rw-r--r--app/src/main/res/layout/config_activity.xml (renamed from app/src/main/res/layout/profile_list_activity.xml)2
-rw-r--r--app/src/main/res/layout/config_detail_fragment.xml (renamed from app/src/main/res/layout/profile_detail_fragment.xml)35
-rw-r--r--app/src/main/res/layout/config_edit_fragment.xml164
-rw-r--r--app/src/main/res/layout/config_list_fragment.xml (renamed from app/src/main/res/layout/profile_list_fragment.xml)11
-rw-r--r--app/src/main/res/layout/config_list_item.xml (renamed from app/src/main/res/layout/profile_list_item.xml)11
-rw-r--r--app/src/main/res/layout/profile_detail_activity.xml6
-rw-r--r--app/src/main/res/layout/profile_edit_activity.xml6
-rw-r--r--app/src/main/res/layout/profile_edit_fragment.xml38
-rw-r--r--app/src/main/res/menu/config_detail.xml (renamed from app/src/main/res/menu/profile_detail.xml)0
-rw-r--r--app/src/main/res/menu/config_edit.xml (renamed from app/src/main/res/menu/profile_edit.xml)0
-rw-r--r--app/src/main/res/values/strings.xml14
12 files changed, 212 insertions, 83 deletions
diff --git a/app/src/main/res/layout-land/profile_list_activity.xml b/app/src/main/res/layout-land/config_activity.xml
index 3f02dcca..b9c729fa 100644
--- a/app/src/main/res/layout-land/profile_list_activity.xml
+++ b/app/src/main/res/layout-land/config_activity.xml
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal">
<FrameLayout
- android:id="@+id/list_container"
+ android:id="@+id/master_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<FrameLayout
- android:id="@+id/fragment_container"
+ android:id="@+id/detail_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="2" />
+ android:layout_weight="2"
+ tools:ignore="InconsistentLayout" />
</LinearLayout>
diff --git a/app/src/main/res/layout/profile_list_activity.xml b/app/src/main/res/layout/config_activity.xml
index 41d772a7..d67e64bc 100644
--- a/app/src/main/res/layout/profile_list_activity.xml
+++ b/app/src/main/res/layout/config_activity.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/list_container"
+ android:id="@+id/master_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
diff --git a/app/src/main/res/layout/profile_detail_fragment.xml b/app/src/main/res/layout/config_detail_fragment.xml
index c08236ce..1bae0450 100644
--- a/app/src/main/res/layout/profile_detail_fragment.xml
+++ b/app/src/main/res/layout/config_detail_fragment.xml
@@ -1,44 +1,43 @@
<?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">
+<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
- name="profile"
- type="com.wireguard.config.Profile" />
+ name="config"
+ type="com.wireguard.config.Config" />
</data>
<ScrollView
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="16dp">
+ android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:padding="16dp">
<TextView
- android:id="@+id/profile_name_label"
+ android:id="@+id/config_name_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
- android:labelFor="@+id/profile_name_text"
- android:text="@string/profile_name" />
+ android:labelFor="@+id/config_name_text"
+ android:text="@string/config_name" />
<TextView
- android:id="@+id/profile_name_text"
+ android:id="@+id/config_name_text"
style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@+id/profile_name_label"
- android:text="@{profile.name}" />
+ android:layout_below="@+id/config_name_label"
+ android:text="@{config.name}" />
<TextView
android:id="@+id/public_key_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@+id/profile_name_text"
+ android:layout_below="@+id/config_name_text"
android:labelFor="@+id/public_key_text"
android:text="@string/public_key" />
@@ -50,7 +49,13 @@
android:layout_below="@+id/public_key_label"
android:ellipsize="end"
android:maxLines="1"
- android:text="@{profile.interface.publicKey}" />
+ android:text="@{config.interface.publicKey}" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/public_key_text"
+ android:text="@{config.toString()}" />
</RelativeLayout>
</ScrollView>
</layout>
diff --git a/app/src/main/res/layout/config_edit_fragment.xml b/app/src/main/res/layout/config_edit_fragment.xml
new file mode 100644
index 00000000..3351c008
--- /dev/null
+++ b/app/src/main/res/layout/config_edit_fragment.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <data>
+
+ <variable
+ name="config"
+ type="com.wireguard.config.Config" />
+ </data>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <TextView
+ android:id="@+id/config_name_label"
+ 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}" />
+
+ <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}" />
+
+ <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_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" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/dns_server_text"
+ android:text="@{config.toString()}" />
+ </RelativeLayout>
+ </ScrollView>
+</layout>
diff --git a/app/src/main/res/layout/profile_list_fragment.xml b/app/src/main/res/layout/config_list_fragment.xml
index f5954092..155e708a 100644
--- a/app/src/main/res/layout/profile_list_fragment.xml
+++ b/app/src/main/res/layout/config_list_fragment.xml
@@ -6,14 +6,15 @@
<!--suppress AndroidDomInspection -->
<variable
- name="profiles"
- type="android.databinding.ObservableArrayMap&lt;String, com.wireguard.config.Profile&gt;" />
+ name="configs"
+ type="android.databinding.ObservableArrayMap&lt;String, com.wireguard.config.Config&gt;" />
</data>
<ListView
- android:id="@+id/profile_list"
+ android:id="@+id/config_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:items="@{profiles}"
- app:layout="@{@layout/profile_list_item}" />
+ android:choiceMode="singleChoice"
+ app:items="@{configs}"
+ app:layout="@{@layout/config_list_item}" />
</layout>
diff --git a/app/src/main/res/layout/profile_list_item.xml b/app/src/main/res/layout/config_list_item.xml
index 22e93f5c..33f447c8 100644
--- a/app/src/main/res/layout/profile_list_item.xml
+++ b/app/src/main/res/layout/config_list_item.xml
@@ -5,17 +5,16 @@
<variable
name="item"
- type="com.wireguard.config.Profile" />
+ type="com.wireguard.config.Config" />
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?android:attr/activatedBackgroundIndicator"
android:padding="16dp">
<TextView
- android:id="@+id/profile_name"
+ android:id="@+id/config_name"
style="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -26,9 +25,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
- android:layout_toEndOf="@+id/profile_name"
- android:text="@{item.isConnected ? @string/connected : @string/disconnected}"
+ android:layout_toEndOf="@+id/config_name"
+ android:text="@{item.isEnabled ? @string/connected : @string/disconnected}"
android:textAlignment="textEnd"
- android:textColor="@{item.isConnected ? @android:color/holo_green_dark : @android:color/holo_red_dark}" />
+ android:textColor="@{item.isEnabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" />
</RelativeLayout>
</layout>
diff --git a/app/src/main/res/layout/profile_detail_activity.xml b/app/src/main/res/layout/profile_detail_activity.xml
deleted file mode 100644
index 0be8d4bd..00000000
--- a/app/src/main/res/layout/profile_detail_activity.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- android:name="com.wireguard.android.ProfileDetailFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:tag="detail" />
diff --git a/app/src/main/res/layout/profile_edit_activity.xml b/app/src/main/res/layout/profile_edit_activity.xml
deleted file mode 100644
index aee54638..00000000
--- a/app/src/main/res/layout/profile_edit_activity.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- android:name="com.wireguard.android.ProfileEditFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:tag="edit" />
diff --git a/app/src/main/res/layout/profile_edit_fragment.xml b/app/src/main/res/layout/profile_edit_fragment.xml
deleted file mode 100644
index 2c25257b..00000000
--- a/app/src/main/res/layout/profile_edit_fragment.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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>
-
- <variable
- name="profile"
- type="com.wireguard.config.Profile" />
- </data>
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="16dp">
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- android:id="@+id/profile_name_label"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:labelFor="@+id/profile_name_text"
- android:text="@string/profile_name" />
-
- <EditText
- android:id="@+id/profile_name_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/profile_name_label"
- android:inputType="textCapWords"
- android:text="@={profile.name}" />
- </RelativeLayout>
- </ScrollView>
-</layout>
diff --git a/app/src/main/res/menu/profile_detail.xml b/app/src/main/res/menu/config_detail.xml
index c00c1603..c00c1603 100644
--- a/app/src/main/res/menu/profile_detail.xml
+++ b/app/src/main/res/menu/config_detail.xml
diff --git a/app/src/main/res/menu/profile_edit.xml b/app/src/main/res/menu/config_edit.xml
index 44e719c7..44e719c7 100644
--- a/app/src/main/res/menu/profile_edit.xml
+++ b/app/src/main/res/menu/config_edit.xml
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 32543006..9b3d1448 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,12 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WireGuard</string>
+ <string name="config_name">Configuration name</string>
<string name="connected">Connected</string>
<string name="disconnected">Disconnected</string>
+ <string name="dns_servers">DNS servers</string>
<string name="edit">Edit</string>
- <string name="edit_activity_title">Edit WireGuard Profile</string>
- <string name="placeholder_text">No profile selected</string>
- <string name="profile_name">Profile name</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="listen_port">Listen port</string>
+ <string name="mtu">MTU</string>
+ <string name="placeholder_text">No configuration selected</string>
+ <string name="private_key">Private key</string>
<string name="public_key">Public key</string>
<string name="save">Save</string>
<string name="settings">Settings</string>