public ViewHolderLogin(View itemView) { super(itemView); loginLayout = itemView.findViewById(R.id.login_layout); name = (KeyEditText) itemView.findViewById(R.id.username); password = (KeyEditText) itemView.findViewById(R.id.password); loginBtn = (Button) itemView.findViewById(R.id.login_btn); name.setKeyPreImeListener(this); password.setKeyPreImeListener(this); name.addTextChangedListener(textWatcher); password.addTextChangedListener(textWatcher); }
@Override public void onKeyPreImeUp(int keyCode, KeyEvent event) { name.clearFocus(); password.clearFocus(); }
private void enableLoginBtn() { loginBtn.setEnabled(name.getText().length() != 0 && password.getText().length() != 0); }