don't show key spinner for a single entry
This commit is contained in:
@@ -298,7 +298,9 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements
|
|||||||
vProgress.setDisplayedChild(1);
|
vProgress.setDisplayedChild(1);
|
||||||
if (!isSecret) {
|
if (!isSecret) {
|
||||||
showButton(2);
|
showButton(2);
|
||||||
vKeySpinnerContainer.setVisibility(View.VISIBLE);
|
if (!vKeySpinner.isSingleEntry()) {
|
||||||
|
vKeySpinnerContainer.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showButton(1);
|
showButton(1);
|
||||||
vKeySpinnerContainer.setVisibility(View.GONE);
|
vKeySpinnerContainer.setVisibility(View.GONE);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
|
|||||||
|
|
||||||
public class CertifyKeySpinner extends KeySpinner {
|
public class CertifyKeySpinner extends KeySpinner {
|
||||||
private long mHiddenMasterKeyId = Constants.key.none;
|
private long mHiddenMasterKeyId = Constants.key.none;
|
||||||
|
private boolean mIsSingle;
|
||||||
|
|
||||||
public CertifyKeySpinner(Context context) {
|
public CertifyKeySpinner(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -99,6 +100,7 @@ public class CertifyKeySpinner extends KeySpinner {
|
|||||||
// - there are actually keys (not just "none" entry)
|
// - there are actually keys (not just "none" entry)
|
||||||
// Then:
|
// Then:
|
||||||
// - select key that is capable of certifying, but only if there is only one key capable of it
|
// - 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) {
|
if (mSelectedKeyId == Constants.key.none && mAdapter.getCount() > 1) {
|
||||||
// preselect if key can certify
|
// preselect if key can certify
|
||||||
int selection = -1;
|
int selection = -1;
|
||||||
@@ -106,9 +108,11 @@ public class CertifyKeySpinner extends KeySpinner {
|
|||||||
if (!data.isNull(mIndexHasCertify)) {
|
if (!data.isNull(mIndexHasCertify)) {
|
||||||
if (selection == -1) {
|
if (selection == -1) {
|
||||||
selection = data.getPosition() + 1;
|
selection = data.getPosition() + 1;
|
||||||
|
mIsSingle = true;
|
||||||
} else {
|
} else {
|
||||||
// if selection is already set, we have more than one certify key!
|
// if selection is already set, we have more than one certify key!
|
||||||
// get back to "none"!
|
// get back to "none"!
|
||||||
|
mIsSingle = false;
|
||||||
selection = 0;
|
selection = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,6 +122,9 @@ public class CertifyKeySpinner extends KeySpinner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSingleEntry() {
|
||||||
|
return mIsSingle && getSelectedItemPosition() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean setStatus(Context context, Cursor cursor, ImageView statusView) {
|
boolean setStatus(Context context, Cursor cursor, ImageView statusView) {
|
||||||
|
|||||||
Reference in New Issue
Block a user