summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/res
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-11-24 23:44:18 -0600
committerSamuel Holland <samuel@sholland.org>2017-11-24 23:44:18 -0600
commitf1febcf9b626a97a5aa75029b3ba90c26e468b2f (patch)
tree7da180360e6b992feacbdbe3111d3d3e4baf7013 /app/src/main/res
parent32338556303ab231bcd265e36a1e617e9bfbfe69 (diff)
ConfigList: Poor man's switch
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/layout/config_list_item.xml10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/src/main/res/layout/config_list_item.xml b/app/src/main/res/layout/config_list_item.xml
index 578db833..87380dee 100644
--- a/app/src/main/res/layout/config_list_item.xml
+++ b/app/src/main/res/layout/config_list_item.xml
@@ -20,6 +20,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_item_background_anim"
+ android:descendantFocusability="blocksDescendants"
android:padding="16dp">
<TextView
@@ -34,16 +35,13 @@
android:text="@{key}"
android:textStyle="@{item.primary ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT}" />
- <TextView
+ <Switch
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: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}" />
+ android:checked="@{item.enabled}"
+ android:onCheckedChanged="@{(v, checked) -> checked ? VpnService.instance.enable(item.name) : VpnService.instance.disable(item.name)}" />
</RelativeLayout>
</layout>