summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/res/layout
diff options
context:
space:
mode:
authorEric Kuck <eric@bluelinelabs.com>2018-07-04 16:47:55 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-06 04:14:19 +0200
commitc74f219fb950a0b64fa5faf312c72e9c96cca4f8 (patch)
tree8eee63dc202e5e1414354f5827873a1e9c642be9 /app/src/main/res/layout
parentb7047ad8960fbf824536104d9cbde72327479af4 (diff)
AppListDialogFragment: add implementation for excluding applications
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'app/src/main/res/layout')
-rw-r--r--app/src/main/res/layout/app_list_dialog_fragment.xml43
-rw-r--r--app/src/main/res/layout/app_list_item.xml56
-rw-r--r--app/src/main/res/layout/tunnel_editor_fragment.xml13
3 files changed, 112 insertions, 0 deletions
diff --git a/app/src/main/res/layout/app_list_dialog_fragment.xml b/app/src/main/res/layout/app_list_dialog_fragment.xml
new file mode 100644
index 00000000..25879b6b
--- /dev/null
+++ b/app/src/main/res/layout/app_list_dialog_fragment.xml
@@ -0,0 +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">
+
+ <data>
+
+ <import type="android.view.View" />
+
+ <import type="com.wireguard.android.model.ApplicationData" />
+
+ <variable
+ name="fragment"
+ type="com.wireguard.android.fragment.AppListDialogFragment" />
+
+ <variable
+ name="appData"
+ type="com.wireguard.android.util.ObservableKeyedList&lt;String, ApplicationData&gt;" />
+ </data>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:minHeight="200dp" >
+
+ <ProgressBar
+ android:id="@+id/progress_bar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:indeterminate="true"
+ android:visibility="@{appData.isEmpty() ? View.VISIBLE : View.GONE}"/>
+
+ <android.support.v7.widget.RecyclerView
+ android:id="@+id/app_list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:items="@{appData}"
+ app:layout="@{@layout/app_list_item}" />
+
+ </FrameLayout>
+
+
+</layout>
diff --git a/app/src/main/res/layout/app_list_item.xml b/app/src/main/res/layout/app_list_item.xml
new file mode 100644
index 00000000..d4a41c83
--- /dev/null
+++ b/app/src/main/res/layout/app_list_item.xml
@@ -0,0 +1,56 @@
+<?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.model.ApplicationData" />
+
+ <variable
+ name="collection"
+ type="com.wireguard.android.util.ObservableKeyedList&lt;String, com.wireguard.android.model.ApplicationData&gt;" />
+
+ <variable
+ name="key"
+ type="String" />
+
+ <variable
+ name="item"
+ type="com.wireguard.android.model.ApplicationData" />
+ </data>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/list_item_background_anim"
+ android:padding="16dp"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:onClick="@{(view) -> item.setExcludedFromTunnel(!item.excludedFromTunnel)}">
+
+ <ImageView
+ android:id="@+id/app_icon"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:src="@{item.icon}" />
+
+ <TextView
+ android:id="@+id/app_name"
+ style="?android:attr/textAppearanceMedium"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:paddingEnd="8dp"
+ android:paddingStart="8dp"
+ android:text="@{key}" />
+
+ <CheckBox
+ android:id="@+id/excluded_checkbox"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:checked="@={item.excludedFromTunnel}" />
+
+ </LinearLayout>
+</layout>
diff --git a/app/src/main/res/layout/tunnel_editor_fragment.xml b/app/src/main/res/layout/tunnel_editor_fragment.xml
index 060920d6..cbdc46cf 100644
--- a/app/src/main/res/layout/tunnel_editor_fragment.xml
+++ b/app/src/main/res/layout/tunnel_editor_fragment.xml
@@ -14,6 +14,10 @@
<import type="com.wireguard.config.Peer" />
<variable
+ name="fragment"
+ type="com.wireguard.android.fragment.TunnelEditorFragment" />
+
+ <variable
name="config"
type="com.wireguard.config.Config.Observable" />
</data>
@@ -211,6 +215,15 @@
android:inputType="number"
android:text="@={config.interfaceSection.mtu}"
android:textAlignment="center" />
+
+ <Button
+ style="@style/Widget.AppCompat.Button.Borderless.Colored"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="-8dp"
+ android:layout_below="@+id/dns_servers_text"
+ android:onClick="@{fragment::onRequestSetExcludedApplications}"
+ android:text="@{fragment.excludedApplications().length == 0 ? @string/set_excluded_applications : String.format(@string/x_excluded_applications, fragment.excludedApplications().length)}" />
</RelativeLayout>
</android.support.v7.widget.CardView>