mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-04 08:15:02 -05:00
pre-select certification key if only one is available
This commit is contained in:
parent
72acaaa41f
commit
ad8209bd94
@ -86,16 +86,17 @@ public class CertifyKeySpinner extends KeySpinner {
|
|||||||
super.onLoadFinished(loader, data);
|
super.onLoadFinished(loader, data);
|
||||||
|
|
||||||
if (loader.getId() == LOADER_ID) {
|
if (loader.getId() == LOADER_ID) {
|
||||||
// If there is only one choice, pick it by default
|
|
||||||
if (mAdapter.getCount() == 2) {
|
|
||||||
// preselect if key can certify
|
|
||||||
if (data.moveToPosition(1) && !data.isNull(mIndexHasCertify)) {
|
|
||||||
setSelection(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mIndexHasCertify = data.getColumnIndex(KeychainContract.KeyRings.HAS_CERTIFY);
|
mIndexHasCertify = data.getColumnIndex(KeychainContract.KeyRings.HAS_CERTIFY);
|
||||||
mIndexIsRevoked = data.getColumnIndex(KeychainContract.KeyRings.IS_REVOKED);
|
mIndexIsRevoked = data.getColumnIndex(KeychainContract.KeyRings.IS_REVOKED);
|
||||||
mIndexIsExpired = data.getColumnIndex(KeychainContract.KeyRings.IS_EXPIRED);
|
mIndexIsExpired = data.getColumnIndex(KeychainContract.KeyRings.IS_EXPIRED);
|
||||||
|
|
||||||
|
// If there is only one choice, pick it by default
|
||||||
|
if (mAdapter.getCount() == 2) {
|
||||||
|
// preselect if key can certify
|
||||||
|
if (data.moveToPosition(0) && !data.isNull(mIndexHasCertify)) {
|
||||||
|
setSelection(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user