diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java index fc912fccb..6dd254aa1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java @@ -91,11 +91,17 @@ public class CertifyKeySpinner extends KeySpinner { mIndexIsRevoked = data.getColumnIndex(KeychainContract.KeyRings.IS_REVOKED); mIndexIsExpired = data.getColumnIndex(KeychainContract.KeyRings.IS_EXPIRED); - // If there is only one choice, pick it by default - if (mAdapter.getCount() == 2) { + // If there is more than one choice, pick a key + if (mAdapter.getCount() >= 2) { // preselect if key can certify - if (data.moveToPosition(0) && !data.isNull(mIndexHasCertify)) { - setSelection(1); + if (data.moveToPosition(0)) { + do { + if (!data.isNull(mIndexHasCertify)) { + setSelection(data.getPosition() + 1); + break; + } + } + while (data.moveToNext()); } } } |