Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed responsiveness of Login button based on emptiness of field #78

Closed

Conversation

AroraMehul
Copy link
Contributor

@AroraMehul AroraMehul commented Apr 8, 2020

Fixes #77

Login button becomes responsive only when both the username and password fields are not empty, otherwise it remains translucent and disabled


binding.etUsername.addTextChangedListener(object : TextWatcher{
override fun afterTextChanged(p0: Editable?) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for the blank line here.

login_btn.alpha = 1.0F
login_btn.isEnabled = true
}
else{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else{
else {

if(et_password.text.toString().isNotEmpty() && et_username.text.toString().isNotEmpty()) {
login_btn.alpha = 1.0F
login_btn.isEnabled = true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
} else {


binding.etPassword.addTextChangedListener(object : TextWatcher{
override fun afterTextChanged(p0: Editable?) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the blank line.

}

override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the blank line.

if(et_password.text.toString().isNotEmpty() && et_username.text.toString().isNotEmpty()) {
login_btn.alpha = 1.0F
login_btn.isEnabled = true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same changes as above should be made here too.

@yashk2000
Copy link
Collaborator

Continued in #91

@yashk2000 yashk2000 closed this Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Login button still responsive even when fields are empty
2 participants