mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12: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
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
// clear password field
|
|
||||||
mPasswordView.removeTextChangedListener(this);
|
|
||||||
mPasswordView.setText("");
|
|
||||||
mPasswordView.addTextChangedListener(this);
|
|
||||||
|
|
||||||
// hide password fields, show client certificate spinner
|
// hide password fields, show client certificate spinner
|
||||||
mPasswordView.setVisibility(View.GONE);
|
mPasswordView.setVisibility(View.GONE);
|
||||||
mClientCertificateSpinner.setVisibility(View.VISIBLE);
|
mClientCertificateSpinner.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
// clear client certificate spinner
|
|
||||||
mClientCertificateSpinner.setOnClientCertificateChangedListener(null);
|
|
||||||
mClientCertificateSpinner.setAlias(null);
|
|
||||||
mClientCertificateSpinner.setOnClientCertificateChangedListener(this);
|
|
||||||
|
|
||||||
// show password fields, hide client certificate spinner
|
// show password fields, hide client certificate spinner
|
||||||
mPasswordView.setVisibility(View.VISIBLE);
|
mPasswordView.setVisibility(View.VISIBLE);
|
||||||
mClientCertificateSpinner.setVisibility(View.GONE);
|
mClientCertificateSpinner.setVisibility(View.GONE);
|
||||||
@ -175,7 +165,7 @@ public class AccountSetupBasics extends K9Activity
|
|||||||
String email = mEmailView.getText().toString();
|
String email = mEmailView.getText().toString();
|
||||||
|
|
||||||
boolean valid = Utility.requiredFieldValid(mEmailView)
|
boolean valid = Utility.requiredFieldValid(mEmailView)
|
||||||
&& (Utility.requiredFieldValid(mPasswordView)
|
&& ((!clientCertificateChecked && Utility.requiredFieldValid(mPasswordView))
|
||||||
|| (clientCertificateChecked && clientCertificateAlias != null))
|
|| (clientCertificateChecked && clientCertificateAlias != null))
|
||||||
&& mEmailValidator.isValidAddressOnly(email);
|
&& mEmailValidator.isValidAddressOnly(email);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user