diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-11-27 04:35:04 +0100 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-11-27 04:35:04 +0100 |
commit | 2cc7f6c2ea852f5b51b7022242833e6e92ce79fe (patch) | |
tree | c7a4dc385db428ae57327c667e935efaafa22c70 /app/src/main/res/layout | |
parent | 6bc6aea2d0a73d866092d7cfb318caf5ff351437 (diff) |
ConfigDetailFragment: wire up toggle switch
Finally no gross colors.
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.xml | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/src/main/res/layout/config_detail_fragment.xml b/app/src/main/res/layout/config_detail_fragment.xml index 206263dc..f5cd2acb 100644 --- a/app/src/main/res/layout/config_detail_fragment.xml +++ b/app/src/main/res/layout/config_detail_fragment.xml @@ -5,6 +5,8 @@ <data> + <import type="com.wireguard.android.backends.VpnService" /> + <variable name="config" type="com.wireguard.config.Config" /> @@ -39,19 +41,17 @@ android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginBottom="8dp" + android:layout_toStartOf="@+id/config_switch" android:text="@string/status" /> - <TextView - android:id="@+id/status_text" - style="?android:attr/textAppearanceMedium" + <com.wireguard.android.widgets.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" - android:layout_toEndOf="@+id/status_label" - android:gravity="end" - android:text="@{config.enabled ? @string/enabled : @string/disabled}" - android:textColor="@{config.enabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" /> + 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" |