mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Do not enable 'Login' button if either password or username is empty
This commit is contained in:
parent
d0f2c87439
commit
78ba373c80
1 changed files with 6 additions and 3 deletions
|
|
@ -140,19 +140,22 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
||||||
passwordEdit = (EditText) findViewById(R.id.loginPassword);
|
passwordEdit = (EditText) findViewById(R.id.loginPassword);
|
||||||
final Activity that = this;
|
final Activity that = this;
|
||||||
|
|
||||||
usernameEdit.addTextChangedListener(new TextWatcher() {
|
TextWatcher loginEnabler = new TextWatcher() {
|
||||||
public void beforeTextChanged(CharSequence charSequence, int start, int count, int after) { }
|
public void beforeTextChanged(CharSequence charSequence, int start, int count, int after) { }
|
||||||
|
|
||||||
public void onTextChanged(CharSequence charSequence, int start, int count, int after) { }
|
public void onTextChanged(CharSequence charSequence, int start, int count, int after) { }
|
||||||
|
|
||||||
public void afterTextChanged(Editable editable) {
|
public void afterTextChanged(Editable editable) {
|
||||||
if(usernameEdit.getText().length() != 0) {
|
if(usernameEdit.getText().length() != 0 && passwordEdit.getText().length() != 0) {
|
||||||
loginButton.setEnabled(true);
|
loginButton.setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
loginButton.setEnabled(false);
|
loginButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
usernameEdit.addTextChangedListener(loginEnabler);
|
||||||
|
passwordEdit.addTextChangedListener(loginEnabler);
|
||||||
|
|
||||||
loginButton.setOnClickListener(new View.OnClickListener() {
|
loginButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue