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;
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public class EmailAddressValidator implements Validator
|
|
|
|
{
|
|
|
|
public CharSequence fixText(CharSequence invalidText)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean isValid(CharSequence text)
|
2010-02-15 07:51:38 -05:00
|
|
|
{
|
|
|
|
return Rfc822Tokenizer.tokenize(text).length > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isValidAddressOnly(CharSequence text)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-04-08 07:51:54 -04:00
|
|
|
return android.text.util.Regex.EMAIL_ADDRESS_PATTERN.matcher(text).matches();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|