Touch view only once

This commit is contained in:
Dominik Schürmann 2014-05-06 15:04:09 +02:00
parent 8564c4aca1
commit f91457e07f

View File

@ -204,26 +204,28 @@ public class ViewKeyMainFragment extends Fragment implements
mActionEditDivider.setVisibility(View.GONE); mActionEditDivider.setVisibility(View.GONE);
} }
// It's easier to reset to defaults beforehand, saves some nasty else clauses
mStatusRevoked.setVisibility(View.GONE);
mStatusExpired.setVisibility(View.GONE);
mActionCertify.setEnabled(true);
mActionEdit.setEnabled(true);
mActionEncrypt.setEnabled(true);
// If this key is revoked, it cannot be used for anything! // If this key is revoked, it cannot be used for anything!
if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) { if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) {
mStatusRevoked.setVisibility(View.VISIBLE); mStatusRevoked.setVisibility(View.VISIBLE);
mActionCertify.setEnabled(false); mStatusExpired.setVisibility(View.GONE);
mActionEdit.setEnabled(false); mActionEdit.setEnabled(false);
mActionCertify.setEnabled(false);
mActionEncrypt.setEnabled(false); mActionEncrypt.setEnabled(false);
} else { } else {
mActionEdit.setEnabled(true);
Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000); Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000);
if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) { if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) {
mStatusRevoked.setVisibility(View.GONE);
mStatusExpired.setVisibility(View.VISIBLE); mStatusExpired.setVisibility(View.VISIBLE);
mActionCertify.setEnabled(false); mActionCertify.setEnabled(false);
mActionEncrypt.setEnabled(false); mActionEncrypt.setEnabled(false);
// mActionEdit is still fine } else {
mStatusRevoked.setVisibility(View.GONE);
mStatusExpired.setVisibility(View.GONE);
mActionCertify.setEnabled(true);
mActionEncrypt.setEnabled(true);
} }
} }