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

Remove "m" prefix of field names

This commit is contained in:
cketti 2015-02-21 02:52:55 +01:00
parent ab877453d9
commit fd99c279e5

View File

@ -1,6 +1,7 @@
package com.fsck.k9.ui.messageview; package com.fsck.k9.ui.messageview;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
@ -17,42 +18,44 @@ import com.fsck.k9.R;
import org.openintents.openpgp.OpenPgpSignatureResult; import org.openintents.openpgp.OpenPgpSignatureResult;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
public class OpenPgpHeaderView extends LinearLayout { public class OpenPgpHeaderView extends LinearLayout {
private Context mContext; private Context context;
private OpenPgpHeaderViewCallback callback; private OpenPgpHeaderViewCallback callback;
private OpenPgpSignatureResult signatureResult; private OpenPgpSignatureResult signatureResult;
private boolean encrypted; private boolean encrypted;
private PendingIntent pendingIntent; private PendingIntent pendingIntent;
private ImageView mResultEncryptionIcon; private ImageView resultEncryptionIcon;
private TextView mResultEncryptionText; private TextView resultEncryptionText;
private ImageView mResultSignatureIcon; private ImageView resultSignatureIcon;
private TextView mResultSignatureText; private TextView resultSignatureText;
private LinearLayout mResultSignatureLayout; private LinearLayout resultSignatureLayout;
private TextView mResultSignatureName; private TextView resultSignatureName;
private TextView mResultSignatureEmail; private TextView resultSignatureEmail;
private Button mResultSignatureButton; private Button resultSignatureButton;
public OpenPgpHeaderView(Context context, AttributeSet attrs) { public OpenPgpHeaderView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mContext = context; this.context = context;
} }
@Override @Override
public void onFinishInflate() { public void onFinishInflate() {
mResultEncryptionIcon = (ImageView) findViewById(R.id.result_encryption_icon); resultEncryptionIcon = (ImageView) findViewById(R.id.result_encryption_icon);
mResultEncryptionText = (TextView) findViewById(R.id.result_encryption_text); resultEncryptionText = (TextView) findViewById(R.id.result_encryption_text);
mResultSignatureIcon = (ImageView) findViewById(R.id.result_signature_icon); resultSignatureIcon = (ImageView) findViewById(R.id.result_signature_icon);
mResultSignatureText = (TextView) findViewById(R.id.result_signature_text); resultSignatureText = (TextView) findViewById(R.id.result_signature_text);
mResultSignatureLayout = (LinearLayout) findViewById(R.id.result_signature_layout); resultSignatureLayout = (LinearLayout) findViewById(R.id.result_signature_layout);
mResultSignatureName = (TextView) findViewById(R.id.result_signature_name); resultSignatureName = (TextView) findViewById(R.id.result_signature_name);
mResultSignatureEmail = (TextView) findViewById(R.id.result_signature_email); resultSignatureEmail = (TextView) findViewById(R.id.result_signature_email);
mResultSignatureButton = (Button) findViewById(R.id.result_signature_button); resultSignatureButton = (Button) findViewById(R.id.result_signature_button);
} }
public void setOpenPgpData(OpenPgpSignatureResult signatureResult, public void setOpenPgpData(OpenPgpSignatureResult signatureResult,
boolean encrypted, PendingIntent pendingIntent) { boolean encrypted, PendingIntent pendingIntent) {
this.signatureResult = signatureResult; this.signatureResult = signatureResult;
this.encrypted = encrypted; this.encrypted = encrypted;
this.pendingIntent = pendingIntent; this.pendingIntent = pendingIntent;
@ -67,100 +70,102 @@ public class OpenPgpHeaderView extends LinearLayout {
public void displayOpenPgpView() { public void displayOpenPgpView() {
if (pendingIntent != null) { if (pendingIntent != null) {
mResultSignatureButton.setOnClickListener(new OnClickListener() { resultSignatureButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
callback.onPgpSignatureButtonClick(pendingIntent); callback.onPgpSignatureButtonClick(pendingIntent);
} }
}); });
} else { } else {
mResultSignatureButton.setVisibility(View.GONE); resultSignatureButton.setVisibility(View.GONE);
mResultSignatureButton.setOnClickListener(null); resultSignatureButton.setOnClickListener(null);
} }
if (encrypted) { if (encrypted) {
setStatusImageAndTextColor(mContext, mResultEncryptionIcon, mResultEncryptionText, CryptoState.ENCRYPTED); setStatusImageAndTextColor(context, resultEncryptionIcon, resultEncryptionText, CryptoState.ENCRYPTED);
mResultEncryptionText.setText(R.string.openpgp_result_encrypted); resultEncryptionText.setText(R.string.openpgp_result_encrypted);
} else { } else {
setStatusImageAndTextColor(mContext, mResultEncryptionIcon, mResultEncryptionText, CryptoState.NOT_ENCRYPTED); setStatusImageAndTextColor(context, resultEncryptionIcon, resultEncryptionText, CryptoState.NOT_ENCRYPTED);
mResultEncryptionText.setText(R.string.openpgp_result_not_encrypted); resultEncryptionText.setText(R.string.openpgp_result_not_encrypted);
} }
if (signatureResult == null) { if (signatureResult == null) {
setStatusImageAndTextColor(mContext, mResultSignatureIcon, mResultSignatureText, CryptoState.NOT_SIGNED); setStatusImageAndTextColor(context, resultSignatureIcon, resultSignatureText, CryptoState.NOT_SIGNED);
mResultSignatureText.setText(R.string.openpgp_result_no_signature); resultSignatureText.setText(R.string.openpgp_result_no_signature);
mResultSignatureLayout.setVisibility(View.GONE); resultSignatureLayout.setVisibility(View.GONE);
} else { } else {
switch (signatureResult.getStatus()) { switch (signatureResult.getStatus()) {
case OpenPgpSignatureResult.SIGNATURE_ERROR: { case OpenPgpSignatureResult.SIGNATURE_ERROR: {
setStatusImageAndTextColor(mContext, mResultSignatureIcon, mResultSignatureText, CryptoState.INVALID); setStatusImageAndTextColor(context, resultSignatureIcon, resultSignatureText, CryptoState.INVALID);
mResultSignatureText.setText(R.string.openpgp_result_invalid_signature); resultSignatureText.setText(R.string.openpgp_result_invalid_signature);
mResultSignatureLayout.setVisibility(View.GONE); resultSignatureLayout.setVisibility(View.GONE);
break; break;
} }
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: { case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: {
setStatusImageAndTextColor(mContext, mResultSignatureIcon, mResultSignatureText, CryptoState.VERIFIED); setStatusImageAndTextColor(context, resultSignatureIcon, resultSignatureText, CryptoState.VERIFIED);
mResultSignatureText.setText(R.string.openpgp_result_signature_certified); resultSignatureText.setText(R.string.openpgp_result_signature_certified);
setUserId(signatureResult); setUserId(signatureResult);
if (pendingIntent != null) { if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE); resultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show); resultSignatureButton.setText(R.string.openpgp_result_action_show);
} }
mResultSignatureLayout.setVisibility(View.VISIBLE); resultSignatureLayout.setVisibility(View.VISIBLE);
break; break;
} }
case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: { case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: {
setStatusImageAndTextColor(mContext, mResultSignatureIcon, mResultSignatureText, CryptoState.UNKNOWN_KEY); setStatusImageAndTextColor(context, resultSignatureIcon, resultSignatureText,
mResultSignatureText.setText(R.string.openpgp_result_signature_missing_key); CryptoState.UNKNOWN_KEY);
resultSignatureText.setText(R.string.openpgp_result_signature_missing_key);
setUserId(signatureResult); setUserId(signatureResult);
if (pendingIntent != null) { if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE); resultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_lookup); resultSignatureButton.setText(R.string.openpgp_result_action_lookup);
} }
mResultSignatureLayout.setVisibility(View.VISIBLE); resultSignatureLayout.setVisibility(View.VISIBLE);
break; break;
} }
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: { case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: {
setStatusImageAndTextColor(mContext, mResultSignatureIcon, mResultSignatureText, CryptoState.UNVERIFIED); setStatusImageAndTextColor(context, resultSignatureIcon, resultSignatureText,
mResultSignatureText.setText(R.string.openpgp_result_signature_uncertified); CryptoState.UNVERIFIED);
resultSignatureText.setText(R.string.openpgp_result_signature_uncertified);
setUserId(signatureResult); setUserId(signatureResult);
if (pendingIntent != null) { if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE); resultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show); resultSignatureButton.setText(R.string.openpgp_result_action_show);
} }
mResultSignatureLayout.setVisibility(View.VISIBLE); resultSignatureLayout.setVisibility(View.VISIBLE);
break; break;
} }
case OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED: { case OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED: {
setStatusImageAndTextColor(mContext, mResultSignatureIcon, mResultSignatureText, CryptoState.EXPIRED); setStatusImageAndTextColor(context, resultSignatureIcon, resultSignatureText, CryptoState.EXPIRED);
mResultSignatureText.setText(R.string.openpgp_result_signature_expired_key); resultSignatureText.setText(R.string.openpgp_result_signature_expired_key);
setUserId(signatureResult); setUserId(signatureResult);
if (pendingIntent != null) { if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE); resultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show); resultSignatureButton.setText(R.string.openpgp_result_action_show);
} }
mResultSignatureLayout.setVisibility(View.VISIBLE); resultSignatureLayout.setVisibility(View.VISIBLE);
break; break;
} }
case OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED: { case OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED: {
setStatusImageAndTextColor(mContext, mResultSignatureIcon, mResultSignatureText, CryptoState.REVOKED); setStatusImageAndTextColor(context, resultSignatureIcon, resultSignatureText, CryptoState.REVOKED);
mResultSignatureText.setText(R.string.openpgp_result_signature_revoked_key); resultSignatureText.setText(R.string.openpgp_result_signature_revoked_key);
setUserId(signatureResult); setUserId(signatureResult);
if (pendingIntent != null) { if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE); resultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show); resultSignatureButton.setText(R.string.openpgp_result_action_show);
} }
mResultSignatureLayout.setVisibility(View.VISIBLE); resultSignatureLayout.setVisibility(View.VISIBLE);
break; break;
} }
@ -175,14 +180,14 @@ public class OpenPgpHeaderView extends LinearLayout {
private void setUserId(OpenPgpSignatureResult signatureResult) { private void setUserId(OpenPgpSignatureResult signatureResult) {
final OpenPgpUtils.UserInfo userInfo = OpenPgpUtils.splitUserId(signatureResult.getPrimaryUserId()); final OpenPgpUtils.UserInfo userInfo = OpenPgpUtils.splitUserId(signatureResult.getPrimaryUserId());
if (userInfo.name != null) { if (userInfo.name != null) {
mResultSignatureName.setText(userInfo.name); resultSignatureName.setText(userInfo.name);
} else { } else {
mResultSignatureName.setText(R.string.openpgp_result_no_name); resultSignatureName.setText(R.string.openpgp_result_no_name);
} }
if (userInfo.email != null) { if (userInfo.email != null) {
mResultSignatureEmail.setText(userInfo.email); resultSignatureEmail.setText(userInfo.email);
} else { } else {
mResultSignatureEmail.setText(R.string.openpgp_result_no_email); resultSignatureEmail.setText(R.string.openpgp_result_no_email);
} }
} }