Search in sources :

Example 1 with PasswordFieldValidator

use of com.firebase.ui.auth.ui.email.fieldvalidators.PasswordFieldValidator 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;
}
Also used : EmailFieldValidator(com.firebase.ui.auth.ui.email.fieldvalidators.EmailFieldValidator) PasswordFieldValidator(com.firebase.ui.auth.ui.email.fieldvalidators.PasswordFieldValidator) TextInputLayout(android.support.design.widget.TextInputLayout) View(android.view.View) TextView(android.widget.TextView) RequiredFieldValidator(com.firebase.ui.auth.ui.email.fieldvalidators.RequiredFieldValidator) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)1 TextInputLayout (android.support.design.widget.TextInputLayout)1 View (android.view.View)1 TextView (android.widget.TextView)1 EmailFieldValidator (com.firebase.ui.auth.ui.email.fieldvalidators.EmailFieldValidator)1 PasswordFieldValidator (com.firebase.ui.auth.ui.email.fieldvalidators.PasswordFieldValidator)1 RequiredFieldValidator (com.firebase.ui.auth.ui.email.fieldvalidators.RequiredFieldValidator)1