mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Don't clear widgets when removing
The user may toggle the checkbox, and then decide to toggle it again. This also fixes a problem when restoring the activity state. When the checkbox was restored as checked, the listener was firing and wiping the the restored alias.
This commit is contained in:
parent
acab554ee5
commit
38e9af5320
@ -148,20 +148,10 @@ public class AccountSetupBasics extends K9Activity
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
// clear password field
|
||||
mPasswordView.removeTextChangedListener(this);
|
||||
mPasswordView.setText("");
|
||||
mPasswordView.addTextChangedListener(this);
|
||||
|
||||
// hide password fields, show client certificate spinner
|
||||
mPasswordView.setVisibility(View.GONE);
|
||||
mClientCertificateSpinner.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
// clear client certificate spinner
|
||||
mClientCertificateSpinner.setOnClientCertificateChangedListener(null);
|
||||
mClientCertificateSpinner.setAlias(null);
|
||||
mClientCertificateSpinner.setOnClientCertificateChangedListener(this);
|
||||
|
||||
// show password fields, hide client certificate spinner
|
||||
mPasswordView.setVisibility(View.VISIBLE);
|
||||
mClientCertificateSpinner.setVisibility(View.GONE);
|
||||
@ -175,9 +165,9 @@ public class AccountSetupBasics extends K9Activity
|
||||
String email = mEmailView.getText().toString();
|
||||
|
||||
boolean valid = Utility.requiredFieldValid(mEmailView)
|
||||
&& (Utility.requiredFieldValid(mPasswordView)
|
||||
|| (clientCertificateChecked && clientCertificateAlias != null))
|
||||
&& mEmailValidator.isValidAddressOnly(email);
|
||||
&& ((!clientCertificateChecked && Utility.requiredFieldValid(mPasswordView))
|
||||
|| (clientCertificateChecked && clientCertificateAlias != null))
|
||||
&& mEmailValidator.isValidAddressOnly(email);
|
||||
|
||||
mNextButton.setEnabled(valid);
|
||||
mManualSetupButton.setEnabled(valid);
|
||||
|
Loading…
Reference in New Issue
Block a user