display pendingIntent button when there is a pendingIntent only

This commit is contained in:
Vincent Breitmoser 2015-01-30 11:30:36 +01:00
parent a0b4faf688
commit 0374dc9cb1
3 changed files with 33 additions and 16 deletions

View file

@ -56,6 +56,7 @@ import com.fsck.k9.provider.AttachmentProvider.AttachmentProviderColumns;
import com.fsck.k9.view.MessageHeader.OnLayoutChangedListener;
import com.fsck.k9.view.MessageWebView;
import org.apache.commons.io.IOUtils;
import org.openintents.openpgp.OpenPgpError;
public class MessageContainerView extends LinearLayout implements OnClickListener,
@ -446,7 +447,13 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
resetView();
// Save the text so we can reset the WebView when the user clicks the "Show pictures" button
mText = messageViewContainer.text;
OpenPgpError error = messageViewContainer.pgpError;
if (error != null) {
// TODO make a nice view for this
mText = error.getMessage();
} else {
mText = messageViewContainer.text;
}
mHasAttachments = !messageViewContainer.attachments.isEmpty();
if (mHasAttachments) {

View file

@ -72,6 +72,7 @@ public class OpenPgpHeaderView extends LinearLayout {
}
});
} else {
mResultSignatureButton.setVisibility(View.GONE);
mResultSignatureButton.setOnClickListener(null);
}
@ -93,7 +94,6 @@ public class OpenPgpHeaderView extends LinearLayout {
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_INVALID);
mResultSignatureText.setText(R.string.openpgp_result_invalid_signature);
mResultSignatureButton.setVisibility(View.GONE);
mResultSignatureLayout.setVisibility(View.GONE);
break;
}
@ -102,8 +102,10 @@ public class OpenPgpHeaderView extends LinearLayout {
mResultSignatureText.setText(R.string.openpgp_result_signature_certified);
setUserId(signatureResult);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
mResultSignatureButton.setVisibility(View.VISIBLE);
if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
}
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
@ -113,8 +115,10 @@ public class OpenPgpHeaderView extends LinearLayout {
mResultSignatureText.setText(R.string.openpgp_result_signature_missing_key);
setUserId(signatureResult);
mResultSignatureButton.setText(R.string.openpgp_result_action_lookup);
mResultSignatureButton.setVisibility(View.VISIBLE);
if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_lookup);
}
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
@ -124,8 +128,10 @@ public class OpenPgpHeaderView extends LinearLayout {
mResultSignatureText.setText(R.string.openpgp_result_signature_uncertified);
setUserId(signatureResult);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
mResultSignatureButton.setVisibility(View.VISIBLE);
if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
}
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
@ -135,8 +141,10 @@ public class OpenPgpHeaderView extends LinearLayout {
mResultSignatureText.setText(R.string.openpgp_result_signature_expired_key);
setUserId(signatureResult);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
mResultSignatureButton.setVisibility(View.VISIBLE);
if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
}
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;
@ -146,8 +154,10 @@ public class OpenPgpHeaderView extends LinearLayout {
mResultSignatureText.setText(R.string.openpgp_result_signature_revoked_key);
setUserId(signatureResult);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
mResultSignatureButton.setVisibility(View.VISIBLE);
if (pendingIntent != null) {
mResultSignatureButton.setVisibility(View.VISIBLE);
mResultSignatureButton.setText(R.string.openpgp_result_action_show);
}
mResultSignatureLayout.setVisibility(View.VISIBLE);
break;

View file

@ -28,7 +28,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Not Encrypted (set in-code)"
android:text="Not Encrypted"
android:layout_marginLeft="4dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp" />
@ -51,7 +51,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Signed by (set in-code)"
android:text="Not signed"
android:layout_marginLeft="4dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp" />
@ -95,14 +95,14 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Alice (set in-code)" />
android:text="Alice" />
<TextView
android:id="@+id/result_signature_email"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="alice@example.com (set in-code)"
android:text="alice@example.com"
android:gravity="center_vertical" />
</LinearLayout>