summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/res/layout
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-16 01:47:18 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-16 01:47:18 -0500
commit452641a0eb09d7276e7f6ec6d4260ac509567664 (patch)
treed6d7de7048b29c51c796f8b036d928f53f33c6a8 /app/src/main/res/layout
parent645e263424d6e0064a95103477ddd85dfbb978c9 (diff)
Detail/Edit/ListFragment: Update the layouts
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res/layout')
-rw-r--r--app/src/main/res/layout/config_detail_fragment.xml19
-rw-r--r--app/src/main/res/layout/config_edit_fragment.xml6
-rw-r--r--app/src/main/res/layout/config_list_item.xml16
3 files changed, 17 insertions, 24 deletions
diff --git a/app/src/main/res/layout/config_detail_fragment.xml b/app/src/main/res/layout/config_detail_fragment.xml
index add03c08..b229e568 100644
--- a/app/src/main/res/layout/config_detail_fragment.xml
+++ b/app/src/main/res/layout/config_detail_fragment.xml
@@ -19,26 +19,25 @@
android:padding="16dp">
<TextView
- android:id="@+id/config_name_label"
+ android:id="@+id/status_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" />
+ android:text="@string/status" />
<TextView
- android:id="@+id/config_name_text"
+ android:id="@+id/status_text"
style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@+id/config_name_label"
- android:text="@{config.name}" />
+ android:layout_below="@+id/status_label"
+ android:text="@{config.enabled ? @string/enabled : @string/disabled}" />
<TextView
android:id="@+id/public_key_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@+id/config_name_text"
+ android:layout_below="@id/status_text"
android:labelFor="@+id/public_key_text"
android:text="@string/public_key" />
@@ -51,12 +50,6 @@
android:ellipsize="end"
android:maxLines="1"
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
index 285215fb..4f48727c 100644
--- a/app/src/main/res/layout/config_edit_fragment.xml
+++ b/app/src/main/res/layout/config_edit_fragment.xml
@@ -154,12 +154,6 @@
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/config_list_item.xml b/app/src/main/res/layout/config_list_item.xml
index 52bd385c..23935fdc 100644
--- a/app/src/main/res/layout/config_list_item.xml
+++ b/app/src/main/res/layout/config_list_item.xml
@@ -3,6 +3,8 @@
<data>
+ <import type="com.wireguard.android.VpnService" />
+
<variable
name="item"
type="com.wireguard.config.Config" />
@@ -19,16 +21,20 @@
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:text="@{item.name}" />
<TextView
- style="?android:attr/textAppearanceMedium"
+ android:id="@+id/config_switch"
+ style="?android:attr/textAppearanceButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_alignBaseline="@+id/config_name"
android:layout_alignParentEnd="true"
- android:layout_toEndOf="@+id/config_name"
- android:text="@{item.isEnabled ? @string/connected : @string/disconnected}"
- android:textAlignment="textEnd"
- android:textColor="@{item.isEnabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" />
+ android:gravity="center_vertical"
+ android:onClick="@{() -> item.enabled ? VpnService.instance.disable(item.name) : VpnService.instance.enable(item.name)}"
+ android:text="@string/toggle"
+ android:textColor="@{item.enabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" />
</RelativeLayout>
</layout>