Source:
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.register_email_layout, container, false); 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); mPasswordFieldValidator = new PasswordFieldValidator( mPasswordInput, getResources().getInteger(R.integer.min_password_length)); mNameValidator = new RequiredFieldValidator( (TextInputLayout) v.findViewById(R.id.name_layout)); mEmailFieldValidator = new EmailFieldValidator(mEmailInput); ImeHelper.setImeOnDoneListener(mPasswordEditText, this); mEmailEditText.setOnFocusChangeListener(this); mNameEditText.setOnFocusChangeListener(this); mPasswordEditText.setOnFocusChangeListener(this); v.findViewById(R.id.button_create).setOnClickListener(this); if (savedInstanceState != null) { return v; } String email = mUser.getEmail(); if (!TextUtils.isEmpty(email)) { mEmailEditText.setText(email); } String name = mUser.getName(); if (!TextUtils.isEmpty(name)) { mNameEditText.setText(name); } if (!TextUtils.isEmpty(mNameEditText.getText())) { safeRequestFocus(mPasswordEditText); } else if (!TextUtils.isEmpty(mEmailEditText.getText())) { safeRequestFocus(mNameEditText); } else { safeRequestFocus(mEmailEditText); } return v; }

Target:
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); ImeHelper.setImeOnDoneListener(mPasswordEditText, this); mEmailEditText.setOnFocusChangeListener(this); mNameEditText.setOnFocusChangeListener(this); mPasswordEditText.setOnFocusChangeListener(this); v.findViewById(R.id.button_create).setOnClickListener(this); if (savedInstanceState != null) { return v; } String email = mUser.getEmail(); if (!TextUtils.isEmpty(email)) { mEmailEditText.setText(email); } String name = mUser.getName(); if (!TextUtils.isEmpty(name)) { mNameEditText.setText(name); } if (!TextUtils.isEmpty(mNameEditText.getText())) { safeRequestFocus(mPasswordEditText); } else if (!TextUtils.isEmpty(mEmailEditText.getText())) { safeRequestFocus(mNameEditText); } else { safeRequestFocus(mEmailEditText); } return v; }