summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/config
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-22 21:48:42 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-22 21:48:42 -0500
commitfb919a72262b43ffa3d93239afa6fb1621341f28 (patch)
tree7f85bd1abe55f7252d414075e7413ecb6995ab4b /app/src/main/java/com/wireguard/config
parent5d04714eeae71e2404a3dd61b67a5348cbbc62a2 (diff)
Use data binding to provide EditText input filters
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/config')
-rw-r--r--app/src/main/java/com/wireguard/config/Config.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/config/Config.java b/app/src/main/java/com/wireguard/config/Config.java
index b2885710..c7fdcc87 100644
--- a/app/src/main/java/com/wireguard/config/Config.java
+++ b/app/src/main/java/com/wireguard/config/Config.java
@@ -22,10 +22,11 @@ import java.util.regex.Pattern;
public class Config extends BaseObservable
implements Comparable<Config>, Copyable<Config>, Observable {
+ public static final int NAME_MAX_LENGTH = 16;
private static final Pattern PATTERN = Pattern.compile("^[a-zA-Z0-9_=+.-]{1,16}$");
private static boolean isNameValid(final String name) {
- return PATTERN.matcher(name).matches();
+ return name.length() <= NAME_MAX_LENGTH && PATTERN.matcher(name).matches();
}
private final Interface iface = new Interface();