mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-25 16:01:52 -05:00
Simplify can encrypt check
This commit is contained in:
parent
30a002634d
commit
930d722013
@ -32,7 +32,9 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.OtherHelper;
|
||||
@ -324,17 +326,20 @@ public class ViewKeyMainFragment extends Fragment implements
|
||||
|
||||
mFingerprint.setText(PgpKeyHelper.colorizeFingerprint(fingerprint));
|
||||
}
|
||||
int valid_keys = 0;
|
||||
|
||||
// hide encrypt button if no encryption key is available
|
||||
boolean canEncrypt = false;
|
||||
data.moveToFirst();
|
||||
do{
|
||||
if(data.getInt(KEYS_INDEX_CAN_ENCRYPT) == 1){
|
||||
valid_keys++;
|
||||
do {
|
||||
if (data.getInt(KEYS_INDEX_CAN_ENCRYPT) == 1) {
|
||||
canEncrypt = true;
|
||||
break;
|
||||
}
|
||||
}while(data.moveToNext());
|
||||
if(valid_keys == 0){
|
||||
} while (data.moveToNext());
|
||||
if (!canEncrypt) {
|
||||
mActionEncrypt.setVisibility(View.GONE);
|
||||
}
|
||||
Log.i("Valid Encryption keys", Integer.toString(valid_keys));
|
||||
|
||||
mKeysAdapter.swapCursor(data);
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user