diff options
author | Samuel Holland <samuel@sholland.org> | 2017-08-22 21:48:42 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-08-22 21:48:42 -0500 |
commit | fb919a72262b43ffa3d93239afa6fb1621341f28 (patch) | |
tree | 7f85bd1abe55f7252d414075e7413ecb6995ab4b /app/src/main/res/layout | |
parent | 5d04714eeae71e2404a3dd61b67a5348cbbc62a2 (diff) |
Use data binding to provide EditText input filters
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_edit_fragment.xml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/src/main/res/layout/config_edit_fragment.xml b/app/src/main/res/layout/config_edit_fragment.xml index 4f48727c..fa936517 100644 --- a/app/src/main/res/layout/config_edit_fragment.xml +++ b/app/src/main/res/layout/config_edit_fragment.xml @@ -1,8 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> -<layout xmlns:android="http://schemas.android.com/apk/res/android"> +<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.KeyInputFilter" /> + + <import type="com.wireguard.android.NameInputFilter" /> + <variable name="config" type="com.wireguard.config.Config" /> @@ -32,7 +37,8 @@ android:layout_height="wrap_content" android:layout_below="@+id/config_name_label" android:inputType="textCapWords" - android:text="@={config.name}" /> + android:text="@={config.name}" + app:filter="@{NameInputFilter.newInstance()}" /> <TextView android:id="@+id/private_key_label" @@ -50,7 +56,8 @@ android:layout_below="@+id/private_key_label" android:layout_toStartOf="@+id/generate_private_key_button" android:inputType="textVisiblePassword" - android:text="@={config.interface.privateKey}" /> + android:text="@={config.interface.privateKey}" + app:filter="@{KeyInputFilter.newInstance()}" /> <Button android:id="@+id/generate_private_key_button" |