summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/res/layout
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/res/layout')
-rw-r--r--app/src/main/res/layout/config_activity.xml7
-rw-r--r--app/src/main/res/layout/config_detail_fragment.xml86
-rw-r--r--app/src/main/res/layout/config_edit_fragment.xml219
-rw-r--r--app/src/main/res/layout/config_editor_fragment.xml233
-rw-r--r--app/src/main/res/layout/config_editor_peer.xml (renamed from app/src/main/res/layout/config_edit_peer.xml)8
-rw-r--r--app/src/main/res/layout/config_list_fragment.xml54
-rw-r--r--app/src/main/res/layout/main_activity.xml (renamed from app/src/main/res/layout/add_activity.xml)4
-rw-r--r--app/src/main/res/layout/not_supported_activity.xml15
-rw-r--r--app/src/main/res/layout/tunnel_detail_fragment.xml142
-rw-r--r--app/src/main/res/layout/tunnel_detail_peer.xml (renamed from app/src/main/res/layout/config_detail_peer.xml)8
-rw-r--r--app/src/main/res/layout/tunnel_list_fragment.xml59
-rw-r--r--app/src/main/res/layout/tunnel_list_item.xml (renamed from app/src/main/res/layout/config_list_item.xml)25
12 files changed, 462 insertions, 398 deletions
diff --git a/app/src/main/res/layout/config_activity.xml b/app/src/main/res/layout/config_activity.xml
deleted file mode 100644
index 0f21e2e8..00000000
--- a/app/src/main/res/layout/config_activity.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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"
- 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
deleted file mode 100644
index cf6fdaaf..00000000
--- a/app/src/main/res/layout/config_detail_fragment.xml
+++ /dev/null
@@ -1,86 +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"
- xmlns:tools="http://schemas.android.com/tools">
-
- <data>
-
- <import type="com.wireguard.android.backends.VpnService" />
-
- <variable
- name="config"
- type="com.wireguard.config.Config" />
- </data>
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="?android:attr/colorBackground">
-
- <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/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:layout_toStartOf="@+id/config_switch"
- android:text="@string/status" />
-
- <com.wireguard.android.widget.ToggleSwitch
- android:id="@+id/config_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignBaseline="@+id/status_label"
- android:layout_alignParentEnd="true"
- app:checked="@{config.enabled}"
- app:onBeforeCheckedChanged="@{(v, checked) -> checked ? VpnService.instance.enable(config.name) : VpnService.instance.disable(config.name)}" />
-
- <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_height="wrap_content"
- 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_edit_fragment.xml b/app/src/main/res/layout/config_edit_fragment.xml
deleted file mode 100644
index f7721ac1..00000000
--- a/app/src/main/res/layout/config_edit_fragment.xml
+++ /dev/null
@@ -1,219 +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"
- xmlns:tools="http://schemas.android.com/tools">
-
- <data>
-
- <import type="com.wireguard.android.ConfigEditFragment" />
-
- <import type="com.wireguard.android.KeyInputFilter" />
-
- <import type="com.wireguard.android.NameInputFilter" />
-
- <variable
- name="config"
- type="com.wireguard.config.Config" />
- </data>
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="?android:attr/colorBackground">
-
- <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: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="@={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:onClick="@{(view) -> ConfigEditFragment.copyPublicKey(view.getContext(), config.interface.publicKey)}"
- 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_edit_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.addPeer()}"
- android:text="@string/add_peer" />
- </LinearLayout>
- </ScrollView>
-</layout>
diff --git a/app/src/main/res/layout/config_editor_fragment.xml b/app/src/main/res/layout/config_editor_fragment.xml
new file mode 100644
index 00000000..c0895656
--- /dev/null
+++ b/app/src/main/res/layout/config_editor_fragment.xml
@@ -0,0 +1,233 @@
+<?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&lt;String&gt;" />
+ </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>
diff --git a/app/src/main/res/layout/config_edit_peer.xml b/app/src/main/res/layout/config_editor_peer.xml
index 8e627579..a3a2a9c8 100644
--- a/app/src/main/res/layout/config_edit_peer.xml
+++ b/app/src/main/res/layout/config_editor_peer.xml
@@ -4,7 +4,11 @@
<data>
- <import type="com.wireguard.android.KeyInputFilter" />
+ <import type="com.wireguard.android.widget.KeyInputFilter" />
+
+ <variable
+ name="collection"
+ type="android.databinding.ObservableList&lt;com.wireguard.config.Peer&gt;" />
<variable
name="item"
@@ -41,7 +45,7 @@
android:layout_alignParentTop="true"
android:background="@null"
android:contentDescription="@string/delete"
- android:onClick="@{() -> item.removeSelf()}"
+ android:onClick="@{() -> collection.remove(item)}"
android:src="@drawable/ic_action_delete_black" />
<TextView
diff --git a/app/src/main/res/layout/config_list_fragment.xml b/app/src/main/res/layout/config_list_fragment.xml
deleted file mode 100644
index 627ecb86..00000000
--- a/app/src/main/res/layout/config_list_fragment.xml
+++ /dev/null
@@ -1,54 +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>
-
- <!--suppress AndroidDomInspection -->
- <variable
- name="configs"
- type="com.wireguard.android.databinding.ObservableSortedMap&lt;String, com.wireguard.config.Config&gt;" />
- </data>
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <ListView
- android:id="@+id/config_list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:choiceMode="singleChoice"
- app:items="@{configs}"
- app:layout="@{@layout/config_list_item}" />
-
- <com.getbase.floatingactionbutton.FloatingActionsMenu
- android:id="@+id/add_menu"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentEnd="true"
- android:layout_marginBottom="8dp"
- android:layout_marginEnd="8dp"
- app:fab_labelStyle="@style/fab_label"
- app:fab_labelsPosition="left">
-
- <com.getbase.floatingactionbutton.FloatingActionButton
- android:id="@+id/add_from_file"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:fab_icon="@drawable/ic_action_open"
- app:fab_size="mini"
- app:fab_title="@string/add_from_file" />
-
- <com.getbase.floatingactionbutton.FloatingActionButton
- android:id="@+id/add_from_scratch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:fab_icon="@drawable/ic_action_edit"
- app:fab_size="mini"
- app:fab_title="@string/add_from_scratch" />
- </com.getbase.floatingactionbutton.FloatingActionsMenu>
-
- </RelativeLayout>
-</layout>
diff --git a/app/src/main/res/layout/add_activity.xml b/app/src/main/res/layout/main_activity.xml
index 0f21e2e8..d67e64bc 100644
--- a/app/src/main/res/layout/add_activity.xml
+++ b/app/src/main/res/layout/main_activity.xml
@@ -1,7 +1,5 @@
<?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"
- tools:ignore="MergeRootFrame" />
+ android:layout_height="match_parent" />
diff --git a/app/src/main/res/layout/not_supported_activity.xml b/app/src/main/res/layout/not_supported_activity.xml
deleted file mode 100644
index ff81e7a4..00000000
--- a/app/src/main/res/layout/not_supported_activity.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<layout xmlns:android="http://schemas.android.com/apk/res/android">
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <TextView
- android:id="@+id/not_supported_message"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="32dp"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead" />
- </ScrollView>
-</layout>
diff --git a/app/src/main/res/layout/tunnel_detail_fragment.xml b/app/src/main/res/layout/tunnel_detail_fragment.xml
new file mode 100644
index 00000000..e23536a7
--- /dev/null
+++ b/app/src/main/res/layout/tunnel_detail_fragment.xml
@@ -0,0 +1,142 @@
+<?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.model.Tunnel.State" />
+
+ <import type="com.wireguard.android.util.ClipboardUtils" />
+
+ <variable
+ name="tunnel"
+ type="com.wireguard.android.model.Tunnel" />
+ </data>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="?android:attr/colorBackground">
+
+ <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" />
+
+ <TextView
+ android:id="@+id/interface_name_text"
+ style="?android:attr/textAppearanceMedium"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/interface_name_label"
+ android:text="@{tunnel.name}" />
+
+ <TextView
+ android:id="@+id/status_label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/interface_name_text"
+ android:layout_marginTop="8dp"
+ android:labelFor="@+id/status_text"
+ 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_alignParentStart="true"
+ android:layout_below="@+id/status_label"
+ android:layout_toStartOf="@+id/tunnel_switch"
+ android:text="@{tunnel.state.name}" />
+
+ <com.wireguard.android.widget.ToggleSwitch
+ android:id="@+id/tunnel_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignBaseline="@+id/status_text"
+ android:layout_alignParentEnd="true"
+ android:enabled="@{tunnel.state != State.UNKNOWN}"
+ app:checked="@{tunnel.state == State.UP}"
+ app:onBeforeCheckedChanged="@{() -> tunnel.setState(State.TOGGLE)}" />
+
+ <TextView
+ android:id="@+id/last_change_label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/status_text"
+ android:layout_marginTop="8dp"
+ android:labelFor="@+id/last_change_text"
+ android:text="@string/last_change" />
+
+ <TextView
+ android:id="@+id/last_change_text"
+ style="?android:attr/textAppearanceMedium"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/last_change_label"
+ android:text="@{tunnel.lastStateChange}" />
+
+ <TextView
+ android:id="@+id/public_key_label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/last_change_text"
+ android:layout_marginTop="8dp"
+ 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:contentDescription="@string/public_key_description"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:onClick="@{ClipboardUtils::copyTextView}"
+ android:text="@{tunnel.config.interface.publicKey}" />
+ </RelativeLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="4dp"
+ android:divider="@null"
+ android:orientation="vertical"
+ app:items="@{tunnel.config.peers}"
+ app:layout="@{@layout/tunnel_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/tunnel_detail_peer.xml
index 1bd1b333..0de72dea 100644
--- a/app/src/main/res/layout/config_detail_peer.xml
+++ b/app/src/main/res/layout/tunnel_detail_peer.xml
@@ -4,6 +4,10 @@
<data>
<variable
+ name="collection"
+ type="android.databinding.ObservableList&lt;com.wireguard.config.Peer&gt;" />
+
+ <variable
name="item"
type="com.wireguard.config.Peer" />
</data>
@@ -25,7 +29,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
- android:layout_marginBottom="8dp"
android:text="@string/peer" />
<TextView
@@ -33,6 +36,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/peer_title"
+ android:layout_marginTop="8dp"
android:labelFor="@+id/public_key_text"
android:text="@string/public_key" />
@@ -51,6 +55,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/public_key_text"
+ android:layout_marginTop="8dp"
android:labelFor="@+id/allowed_ips_text"
android:text="@string/allowed_ips" />
@@ -67,6 +72,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/allowed_ips_text"
+ android:layout_marginTop="8dp"
android:labelFor="@+id/endpoint_text"
android:text="@string/endpoint" />
diff --git a/app/src/main/res/layout/tunnel_list_fragment.xml b/app/src/main/res/layout/tunnel_list_fragment.xml
new file mode 100644
index 00000000..e4923d54
--- /dev/null
+++ b/app/src/main/res/layout/tunnel_list_fragment.xml
@@ -0,0 +1,59 @@
+<?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="fragment"
+ type="com.wireguard.android.fragment.TunnelListFragment" />
+
+ <variable
+ name="tunnels"
+ type="com.wireguard.android.model.TunnelCollection" />
+ </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">
+
+ <ListView
+ android:id="@+id/tunnel_list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:choiceMode="multipleChoiceModal"
+ app:items="@{tunnels}"
+ app:layout="@{@layout/tunnel_list_item}" />
+
+ <com.getbase.floatingactionbutton.FloatingActionsMenu
+ android:id="@+id/create_menu"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|end"
+ android:layout_margin="8dp"
+ app:fab_labelStyle="@style/fab_label"
+ app:fab_labelsPosition="left"
+ app:layout_dodgeInsetEdges="bottom">
+
+ <com.getbase.floatingactionbutton.FloatingActionButton
+ android:id="@+id/create_empty"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="@{fragment::onRequestCreateConfig}"
+ app:fab_icon="@drawable/ic_action_edit"
+ app:fab_size="mini"
+ app:fab_title="@string/create_empty" />
+
+ <com.getbase.floatingactionbutton.FloatingActionButton
+ android:id="@+id/create_from_file"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="@{fragment::onRequestImportConfig}"
+ app:fab_icon="@drawable/ic_action_open"
+ app:fab_size="mini"
+ app:fab_title="@string/create_from_file" />
+ </com.getbase.floatingactionbutton.FloatingActionsMenu>
+ </com.commonsware.cwac.crossport.design.widget.CoordinatorLayout>
+</layout>
diff --git a/app/src/main/res/layout/config_list_item.xml b/app/src/main/res/layout/tunnel_list_item.xml
index 90e696a4..c8706546 100644
--- a/app/src/main/res/layout/config_list_item.xml
+++ b/app/src/main/res/layout/tunnel_list_item.xml
@@ -4,9 +4,11 @@
<data>
- <import type="android.graphics.Typeface" />
+ <import type="com.wireguard.android.model.Tunnel.State" />
- <import type="com.wireguard.android.backends.VpnService" />
+ <variable
+ name="collection"
+ type="com.wireguard.android.model.TunnelCollection" />
<variable
name="key"
@@ -14,7 +16,7 @@
<variable
name="item"
- type="com.wireguard.config.Config" />
+ type="com.wireguard.android.model.Tunnel" />
</data>
<RelativeLayout
@@ -25,24 +27,25 @@
android:padding="16dp">
<TextView
- android:id="@+id/config_name"
+ android:id="@+id/tunnel_name"
style="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
- android:layout_toStartOf="@+id/config_switch"
+ android:layout_alignParentTop="true"
+ android:layout_toStartOf="@+id/tunnel_switch"
android:ellipsize="end"
android:maxLines="1"
- android:text="@{key}"
- android:textStyle="@{item.primary ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT}" />
+ android:text="@{key}" />
<com.wireguard.android.widget.ToggleSwitch
- android:id="@+id/config_switch"
+ android:id="@+id/tunnel_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignBaseline="@+id/config_name"
+ android:layout_alignBaseline="@+id/tunnel_name"
android:layout_alignParentEnd="true"
- app:checked="@{item.enabled}"
- app:onBeforeCheckedChanged="@{(v, checked) -> checked ? VpnService.instance.enable(item.name) : VpnService.instance.disable(item.name)}" />
+ android:enabled="@{item.state != State.UNKNOWN}"
+ app:checked="@{item.state == State.UP}"
+ app:onBeforeCheckedChanged="@{() -> item.setState(State.TOGGLE)}" />
</RelativeLayout>
</layout>