1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-04 16:45:09 -05:00

Display signer name and email

This commit is contained in:
Dominik Schürmann 2015-01-28 15:22:38 +01:00
parent 12cf19b63e
commit fdc597aadf
3 changed files with 45 additions and 45 deletions

View File

@ -435,7 +435,8 @@ public class LocalMessageExtractor {
// TODO correctly extract OpenPgpSignatureResult and add to MessageViewContainer
OpenPgpSignatureResult result = null;
result = new OpenPgpSignatureResult(OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED, "lul", false, 0x123);
result = new OpenPgpSignatureResult(OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED, "lul", false, 0x123,
new ArrayList<String>());
containers.add(new MessageViewContainer(viewable.html, attachmentInfos, result, true, null));
}

View File

@ -159,13 +159,13 @@ public class MessageOpenPgpViewOld extends LinearLayout {
R.color.openpgp_green));
mGetKeyButton.setVisibility(View.GONE);
mSignatureUserId.setText(signatureResult.getUserId());
mSignatureUserId.setText(signatureResult.getPrimaryUserId());
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
mSignatureLayout.setVisibility(View.VISIBLE);
break;
case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY:
case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING:
if (signatureResult.isSignatureOnly()) {
mText.setText(R.string.openpgp_signature_unknown_text);
}
@ -193,7 +193,7 @@ public class MessageOpenPgpViewOld extends LinearLayout {
R.color.openpgp_orange));
mGetKeyButton.setVisibility(View.GONE);
mSignatureUserId.setText(signatureResult.getUserId());
mSignatureUserId.setText(signatureResult.getPrimaryUserId());
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
mSignatureLayout.setVisibility(View.VISIBLE);

View File

@ -94,20 +94,18 @@ public class OpenPgpHeaderView extends LinearLayout {
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_VERIFIED);
mResultSignatureText.setText(R.string.openpgp_result_signature_certified);
setUserId(signatureResult);
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureName.setText(OpenPgpUtils.s);
mResultSignatureEmail.setText(signatureResult.getUserId());
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
}
case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY: {
case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: {
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_UNKNOWN_KEY);
mResultSignatureText.setText(R.string.openpgp_result_signature_missing_key);
// mGetKeyButton.setVisibility(View.VISIBLE);
// mSignatureUserId.setText(R.string.openpgp_signature_unknown);
// mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
setUserId(signatureResult);
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
@ -116,39 +114,32 @@ public class OpenPgpHeaderView extends LinearLayout {
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_UNVERIFIED);
mResultSignatureText.setText(R.string.openpgp_result_signature_uncertified);
// if (signatureResult.isSignatureOnly()) {
// mText.setText(R.string.openpgp_signature_valid_uncertified);
// } else {
// mText.setText(R.string.openpgp_successful_decryption_valid_signature_uncertified);
// }
// MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
// R.color.openpgp_orange));
//
// mGetKeyButton.setVisibility(View.GONE);
// mSignatureUserId.setText(signatureResult.getUserId());
// mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
setUserId(signatureResult);
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
}
case OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED: {
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_EXPIRED);
mResultSignatureText.setText(R.string.openpgp_result_signature_expired_key);
setUserId(signatureResult);
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
}
case OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED: {
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_REVOKED);
mResultSignatureText.setText(R.string.openpgp_result_signature_revoked_key);
setUserId(signatureResult);
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
}
// case OpenPgpSignatureResult.SIGN:
// setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_UNVERIFIED);
// mResultSignatureText.setText(R.string.openpgp_result_signature_uncertified);
//
//// if (signatureResult.isSignatureOnly()) {
//// mText.setText(R.string.openpgp_signature_valid_uncertified);
//// } else {
//// mText.setText(R.string.openpgp_successful_decryption_valid_signature_uncertified);
//// }
//// MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
//// R.color.openpgp_orange));
////
//// mGetKeyButton.setVisibility(View.GONE);
//// mSignatureUserId.setText(signatureResult.getUserId());
//// mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
// mResultSignatureLayout.setVisibility(View.VISIBLE);
//
// break;
default:
break;
@ -157,6 +148,20 @@ public class OpenPgpHeaderView extends LinearLayout {
}
}
private void setUserId(OpenPgpSignatureResult signatureResult) {
String[] splitUserId = OpenPgpUtils.splitUserId(signatureResult.getPrimaryUserId());
if (splitUserId[0] != null) {
mResultSignatureName.setText(splitUserId[0]);
} else {
mResultSignatureName.setText("no name");
}
if (splitUserId[1] != null) {
mResultSignatureEmail.setText(splitUserId[1]);
} else {
mResultSignatureEmail.setText("no email");
}
}
public static final int STATE_REVOKED = 1;
public static final int STATE_EXPIRED = 2;
public static final int STATE_VERIFIED = 3;
@ -229,9 +234,6 @@ public class OpenPgpHeaderView extends LinearLayout {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
int color = R.color.openpgp_red;
// if (unobtrusive) {
// color = R.color.bg_gray;
// }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@ -243,9 +245,6 @@ public class OpenPgpHeaderView extends LinearLayout {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_expired_cutout));
int color = R.color.openpgp_red;
// if (unobtrusive) {
// color = R.color.bg_gray;
// }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {