aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java13
1 files changed, 13 insertions, 0 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 460163a47..e5b3df8c9 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
@@ -21,6 +21,7 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
+import android.support.annotation.StringRes;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.util.AttributeSet;
@@ -35,6 +36,7 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
public class CertifyKeySpinner extends KeySpinner {
private long mHiddenMasterKeyId = Constants.key.none;
+ private boolean mIsSingle;
public CertifyKeySpinner(Context context) {
super(context);
@@ -98,6 +100,7 @@ public class CertifyKeySpinner extends KeySpinner {
// - there are actually keys (not just "none" entry)
// Then:
// - select key that is capable of certifying, but only if there is only one key capable of it
+ mIsSingle = false;
if (mSelectedKeyId == Constants.key.none && mAdapter.getCount() > 1) {
// preselect if key can certify
int selection = -1;
@@ -105,9 +108,11 @@ public class CertifyKeySpinner extends KeySpinner {
if (!data.isNull(mIndexHasCertify)) {
if (selection == -1) {
selection = data.getPosition() + 1;
+ mIsSingle = true;
} else {
// if selection is already set, we have more than one certify key!
// get back to "none"!
+ mIsSingle = false;
selection = 0;
}
}
@@ -117,6 +122,9 @@ public class CertifyKeySpinner extends KeySpinner {
}
}
+ public boolean isSingleEntry() {
+ return mIsSingle && getSelectedItemPosition() != 0;
+ }
@Override
boolean setStatus(Context context, Cursor cursor, ImageView statusView) {
@@ -138,4 +146,9 @@ public class CertifyKeySpinner extends KeySpinner {
return true;
}
+ public @StringRes int getNoneString() {
+ return R.string.choice_select_cert;
+ }
+
+
}