2008-11-01 17:32:06 -04:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
package com.fsck.k9;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-02-15 07:51:38 -05:00
|
|
|
import android.text.util.Rfc822Tokenizer;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.widget.AutoCompleteTextView.Validator;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public class EmailAddressValidator implements Validator {
|
|
|
|
public CharSequence fixText(CharSequence invalidText) {
|
2008-11-01 17:32:06 -04:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean isValid(CharSequence text) {
|
2010-02-15 07:51:38 -05:00
|
|
|
return Rfc822Tokenizer.tokenize(text).length > 0;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean isValidAddressOnly(CharSequence text) {
|
2010-05-19 15:16:36 -04:00
|
|
|
return com.fsck.k9.helper.Regex.EMAIL_ADDRESS_PATTERN.matcher(text).matches();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|