use of com.firebase.ui.auth.ui.email.fieldvalidators.RequiredFieldValidator in project FirebaseUI-Android by firebase.
the class RegisterEmailFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.register_email_layout, container, false);
mPasswordFieldValidator = new PasswordFieldValidator((TextInputLayout) v.findViewById(R.id.password_layout), getResources().getInteger(R.integer.min_password_length));
mNameValidator = new RequiredFieldValidator((TextInputLayout) v.findViewById(R.id.name_layout));
mEmailFieldValidator = new EmailFieldValidator((TextInputLayout) v.findViewById(R.id.email_layout));
mEmailEditText = (EditText) v.findViewById(R.id.email);
mNameEditText = (EditText) v.findViewById(R.id.name);
mPasswordEditText = (EditText) v.findViewById(R.id.password);
mAgreementText = (TextView) v.findViewById(R.id.create_account_text);
mEmailInput = (TextInputLayout) v.findViewById(R.id.email_layout);
mPasswordInput = (TextInputLayout) v.findViewById(R.id.password_layout);
mEmailEditText.setOnFocusChangeListener(this);
mNameEditText.setOnFocusChangeListener(this);
mPasswordEditText.setOnFocusChangeListener(this);
v.findViewById(R.id.button_create).setOnClickListener(this);
if (savedInstanceState != null) {
return v;
}
// If email is passed in, fill in the field and move down to the name field.
String email = mUser.getEmail();
if (!TextUtils.isEmpty(email)) {
mEmailEditText.setText(email);
}
// If name is passed in, fill in the field and move down to the password field.
String name = mUser.getName();
if (!TextUtils.isEmpty(name)) {
mNameEditText.setText(name);
}
// See http://stackoverflow.com/questions/11082341/android-requestfocus-ineffective#comment51774752_11082523
if (!TextUtils.isEmpty(mNameEditText.getText())) {
safeRequestFocus(mPasswordEditText);
} else if (!TextUtils.isEmpty(mEmailEditText.getText())) {
safeRequestFocus(mNameEditText);
} else {
safeRequestFocus(mEmailEditText);
}
return v;
}
Aggregations