Trigger certificate chooser on authentication change

If the user chooses client certificate authentication,
immediately pop up the certificate chooser.

If the user chooses password authentication, move the focus to the
password View.
This commit is contained in:
Joe Steele 2014-07-23 15:25:50 -04:00
parent 21cc3d9176
commit 231f3645f9
3 changed files with 22 additions and 2 deletions

View file

@ -323,6 +323,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
long id) {
updateViewFromAuthType();
validateFields();
AuthType selection = (AuthType) mAuthTypeView.getSelectedItem();
// Have the user select (or confirm) the client certificate
if (AuthType.EXTERNAL.equals(selection)) {
// This may again invoke validateFields()
mClientCertificateSpinner.chooseCertificate();
} else {
mPasswordView.requestFocus();
}
}
@Override

View file

@ -223,6 +223,16 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
long id) {
updateViewFromAuthType();
validateFields();
AuthType selection = (AuthType) mAuthTypeView.getSelectedItem();
// Have the user select (or confirm) the client certificate
if (AuthType.EXTERNAL.equals(selection)) {
// This may again invoke validateFields()
mClientCertificateSpinner.chooseCertificate();
} else {
mPasswordView.requestFocus();
}
}
@Override

View file

@ -51,7 +51,7 @@ public class ClientCertificateSpinner extends LinearLayout {
mSelection.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onSelect();
chooseCertificate();
}
});
@ -96,7 +96,7 @@ public class ClientCertificateSpinner extends LinearLayout {
setAlias(null);
}
private void onSelect() {
public void chooseCertificate() {
// NOTE: keyTypes, issuers, hosts, port are not known before we actually
// open a connection, thus we cannot set them here!
KeyChain.choosePrivateKeyAlias(mActivity, new KeyChainAliasCallback() {