From d46d355f69e990d07a1bcd810c7271e616e10f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Wed, 28 Jan 2015 14:54:43 +0100 Subject: [PATCH] OpenPGP status texts and sidebar improvements --- .../k9/ui/messageview/OpenPgpHeaderView.java | 76 ++++++++++--------- .../src/main/res/layout/message_container.xml | 4 +- .../layout/message_view_openpgp_header.xml | 32 +++----- k9mail/src/main/res/values/colors.xml | 2 +- k9mail/src/main/res/values/strings.xml | 12 +++ 5 files changed, 67 insertions(+), 59 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/OpenPgpHeaderView.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/OpenPgpHeaderView.java index 6f3e66d27..7e9fdfa73 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/OpenPgpHeaderView.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/OpenPgpHeaderView.java @@ -4,6 +4,7 @@ package com.fsck.k9.ui.messageview; import android.content.Context; import android.graphics.PorterDuff; import android.util.AttributeSet; +import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -65,68 +66,52 @@ public class OpenPgpHeaderView extends LinearLayout { if (encrypted) { setStatusImage(mContext, mResultEncryptionIcon, mResultEncryptionText, STATE_ENCRYPTED); - -// MessageOpenPgpView.this.setBackgroundColor(mContext.getResources().getColor( -// R.color.openpgp_blue)); -// mText.setText(R.string.openpgp_successful_decryption); + mResultEncryptionText.setText(R.string.openpgp_result_encrypted); } else { setStatusImage(mContext, mResultEncryptionIcon, mResultEncryptionText, STATE_NOT_ENCRYPTED); + mResultEncryptionText.setText(R.string.openpgp_result_not_encrypted); } if (signatureResult == null) { setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_NOT_SIGNED); + mResultSignatureText.setText(R.string.openpgp_result_no_signature); + mResultSignatureLayout.setVisibility(View.GONE); } else { switch (signatureResult.getStatus()) { - case OpenPgpSignatureResult.SIGNATURE_ERROR: + case OpenPgpSignatureResult.SIGNATURE_ERROR: { setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_INVALID); -// // TODO: signature error but decryption works? -// mText.setText(R.string.openpgp_signature_invalid); -// MessageOpenPgpView.this.setBackgroundColor(mContext.getResources().getColor( -// R.color.openpgp_red)); -// + mResultSignatureText.setText(R.string.openpgp_result_invalid_signature); + // mGetKeyButton.setVisibility(View.GONE); // mSignatureStatusImage.setImageResource(R.drawable.overlay_error); -// mSignatureLayout.setVisibility(View.GONE); + mResultSignatureLayout.setVisibility(View.GONE); break; - - case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: + } + case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: { setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_VERIFIED); + mResultSignatureText.setText(R.string.openpgp_result_signature_certified); -// if (signatureResult.isSignatureOnly()) { -// mText.setText(R.string.openpgp_signature_valid_certified); -// } else { -// mText.setText(R.string.openpgp_successful_decryption_valid_signature_certified); -// } -// MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor( -// R.color.openpgp_green)); -// // mGetKeyButton.setVisibility(View.GONE); // mSignatureUserId.setText(signatureResult.getUserId()); // mSignatureStatusImage.setImageResource(R.drawable.overlay_ok); -// mSignatureLayout.setVisibility(View.VISIBLE); + mResultSignatureLayout.setVisibility(View.VISIBLE); break; - - case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY: + } + case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY: { setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_UNKNOWN_KEY); + mResultSignatureText.setText(R.string.openpgp_result_signature_missing_key); -// if (signatureResult.isSignatureOnly()) { -// mText.setText(R.string.openpgp_signature_unknown_text); -// } else { -// mText.setText(R.string.openpgp_successful_decryption_unknown_signature); -// } -// MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor( -// R.color.openpgp_orange)); -// // mGetKeyButton.setVisibility(View.VISIBLE); // mSignatureUserId.setText(R.string.openpgp_signature_unknown); // mSignatureStatusImage.setImageResource(R.drawable.overlay_error); -// mSignatureLayout.setVisibility(View.VISIBLE); + mResultSignatureLayout.setVisibility(View.VISIBLE); break; - - case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: + } + case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: { 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); @@ -139,9 +124,28 @@ public class OpenPgpHeaderView extends LinearLayout { // mGetKeyButton.setVisibility(View.GONE); // mSignatureUserId.setText(signatureResult.getUserId()); // mSignatureStatusImage.setImageResource(R.drawable.overlay_ok); -// mSignatureLayout.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; diff --git a/k9mail/src/main/res/layout/message_container.xml b/k9mail/src/main/res/layout/message_container.xml index 3373e3a41..a27fb2819 100644 --- a/k9mail/src/main/res/layout/message_container.xml +++ b/k9mail/src/main/res/layout/message_container.xml @@ -21,8 +21,8 @@ diff --git a/k9mail/src/main/res/layout/message_view_openpgp_header.xml b/k9mail/src/main/res/layout/message_view_openpgp_header.xml index 4e3ef781b..803692f94 100644 --- a/k9mail/src/main/res/layout/message_view_openpgp_header.xml +++ b/k9mail/src/main/res/layout/message_view_openpgp_header.xml @@ -9,8 +9,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingLeft="8dp" - android:paddingRight="8dp"> + android:paddingLeft="4dp"> + android:layout_marginLeft="4dp" + android:layout_marginTop="2dp" + android:layout_marginBottom="2dp" /> + android:layout_marginLeft="4dp" + android:layout_marginTop="2dp" + android:layout_marginBottom="2dp" /> @@ -74,17 +73,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - diff --git a/k9mail/src/main/res/values/colors.xml b/k9mail/src/main/res/values/colors.xml index 934151299..9742e3b5f 100644 --- a/k9mail/src/main/res/values/colors.xml +++ b/k9mail/src/main/res/values/colors.xml @@ -6,6 +6,6 @@ #FF8800 #669900 #336699 - #ff444444 + #D8D8D8 diff --git a/k9mail/src/main/res/values/strings.xml b/k9mail/src/main/res/values/strings.xml index b01c1a462..b44cc5982 100644 --- a/k9mail/src/main/res/values/strings.xml +++ b/k9mail/src/main/res/values/strings.xml @@ -1116,6 +1116,18 @@ Please submit bug reports, contribute new features and ask questions at Lookup missing key OpenPGP Error: User Id + + "Not Signed" + "Invalid signature!" + "Signed by (not certified!)" + "Signed by" + "Key is expired!" + "Key has been revoked!" + "Unknown public key" + "Encrypted" + "Not Encrypted" + "Show" + "Lookup" Use client certificate