mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 03:32:16 -05:00
OpenPGP status texts and sidebar improvements
This commit is contained in:
parent
e513af9529
commit
d46d355f69
@ -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;
|
||||
|
@ -21,8 +21,8 @@
|
||||
<View
|
||||
android:id="@+id/message_sidebar"
|
||||
android:layout_width="8dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/openpgp_sidebar"
|
||||
android:visibility="gone"/>
|
||||
|
@ -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">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
@ -30,9 +29,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Not Encrypted (set in-code)"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp" />
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -53,9 +52,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Signed by (set in-code)"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp" />
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -65,7 +64,7 @@
|
||||
|
||||
<View
|
||||
android:layout_width="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/openpgp_sidebar" />
|
||||
|
||||
@ -74,17 +73,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/result_signature_divider1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/result_signature_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:paddingRight="4dp"
|
||||
@ -92,7 +84,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="4dp"
|
||||
android:gravity="center_vertical"
|
||||
@ -123,12 +115,12 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<TextView
|
||||
<Button
|
||||
android:id="@+id/result_signature_action"
|
||||
android:paddingLeft="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Show"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical" />
|
||||
|
@ -6,6 +6,6 @@
|
||||
<color name="openpgp_orange">#FF8800</color>
|
||||
<color name="openpgp_green">#669900</color>
|
||||
<color name="openpgp_blue">#336699</color>
|
||||
<color name="openpgp_sidebar">#ff444444</color>
|
||||
<color name="openpgp_sidebar">#D8D8D8</color>
|
||||
|
||||
</resources>
|
||||
|
@ -1116,6 +1116,18 @@ Please submit bug reports, contribute new features and ask questions at
|
||||
<string name="openpgp_get_key">Lookup missing key</string>
|
||||
<string name="openpgp_error">OpenPGP Error:</string>
|
||||
<string name="openpgp_user_id">User Id</string>
|
||||
|
||||
<string name="openpgp_result_no_signature">"Not Signed"</string>
|
||||
<string name="openpgp_result_invalid_signature">"Invalid signature!"</string>
|
||||
<string name="openpgp_result_signature_uncertified">"Signed by (not certified!)"</string>
|
||||
<string name="openpgp_result_signature_certified">"Signed by"</string>
|
||||
<string name="openpgp_result_signature_expired_key">"Key is expired!"</string>
|
||||
<string name="openpgp_result_signature_revoked_key">"Key has been revoked!"</string>
|
||||
<string name="openpgp_result_signature_missing_key">"Unknown public key"</string>
|
||||
<string name="openpgp_result_encrypted">"Encrypted"</string>
|
||||
<string name="openpgp_result_not_encrypted">"Not Encrypted"</string>
|
||||
<string name="openpgp_result_action_show">"Show"</string>
|
||||
<string name="openpgp_result_action_Lookup">"Lookup"</string>
|
||||
|
||||
<!-- === Client certificates specific ================================================================== -->
|
||||
<string name="account_setup_basics_client_certificate">Use client certificate</string>
|
||||
|
Loading…
Reference in New Issue
Block a user