Use more simple email validation regex
This commit is contained in:
@@ -26,7 +26,6 @@ import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -52,6 +51,10 @@ public class CreateKeyEmailFragment extends Fragment {
|
||||
private ArrayList<EmailAdapter.ViewModel> mAdditionalEmailModels;
|
||||
private EmailAdapter mEmailAdapter;
|
||||
|
||||
// NOTE: Do not use more complicated pattern like defined in android.util.Patterns.EMAIL_ADDRESS
|
||||
// EMAIL_ADDRESS fails for mails with umlauts for example
|
||||
private static final Pattern EMAIL_PATTERN = Pattern.compile(".[\\S]+@.[\\S]+\\.[a-z]+");
|
||||
|
||||
/**
|
||||
* Creates new instance of this fragment
|
||||
*/
|
||||
@@ -174,10 +177,8 @@ public class CreateKeyEmailFragment extends Fragment {
|
||||
* @return
|
||||
*/
|
||||
private boolean isEmailFormatValid(String email) {
|
||||
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
|
||||
|
||||
// check for email format or if the user did any input
|
||||
return !(email.length() == 0 || !emailPattern.matcher(email).matches());
|
||||
return !(email.length() == 0 || !EMAIL_PATTERN.matcher(email).matches());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user