Display placeholder for encrypted messages

pull/208/head
M66B 3 years ago
parent ea96d3d1be
commit 43fc00a6d1

@ -2540,6 +2540,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
ibImages.setTooltipText(ibImages.getContentDescription());
if (message.isEncrypted() && !message.isUnlocked()) {
SpannableStringBuilder ssb = new SpannableStringBuilderEx("...");
ssb.setSpan(new StyleSpan(Typeface.BOLD), 0, ssb.length(), 0);
tvBody.setText(ssb);
tvBody.setVisibility(View.VISIBLE);
wvBody.setVisibility(View.GONE);
bindExtras(message);
} else {
if (show_full) {
// Create web view
WebViewEx webView;
@ -2643,6 +2651,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvBody.setVisibility(View.VISIBLE);
wvBody.setVisibility(View.GONE);
}
}
final Bundle args = new Bundle();
args.putSerializable("message", message);
@ -2936,13 +2945,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
// Show images
ibImages.setVisibility(has_images && !(show_full && always_images) ? View.VISIBLE : View.INVISIBLE);
boolean verifyable = (EntityMessage.PGP_SIGNONLY.equals(message.encrypt) ||
EntityMessage.SMIME_SIGNONLY.equals(message.encrypt));
boolean unlocked = (EntityMessage.PGP_SIGNENCRYPT.equals(message.ui_encrypt) &&
!EntityMessage.PGP_SIGNENCRYPT.equals(message.encrypt)) ||
(EntityMessage.SMIME_SIGNENCRYPT.equals(message.ui_encrypt) &&
!EntityMessage.SMIME_SIGNENCRYPT.equals(message.encrypt));
boolean verifiable = message.isVerifiable();
boolean unlocked = message.isUnlocked();
// Show AMP
boolean has_amp = args.getBoolean("has_amp");
@ -2950,7 +2954,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
? View.VISIBLE : View.GONE);
// Show encrypt actions
ibVerify.setVisibility(verifyable ? View.VISIBLE : View.GONE);
ibVerify.setVisibility(verifiable ? View.VISIBLE : View.GONE);
ibDecrypt.setImageResource(unlocked
? R.drawable.twotone_lock_24 : R.drawable.twotone_lock_open_24);
ibDecrypt.setImageTintList(ColorStateList.valueOf(unlocked
@ -2965,6 +2969,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean signed_data = args.getBoolean("signed_data");
tvSignedData.setVisibility(signed_data ? View.VISIBLE : View.GONE);
if (!message.isEncrypted() || message.isUnlocked()) {
if (show_full) {
((WebViewEx) wvBody).setOnPageLoaded(new Runnable() {
@Override
@ -3004,6 +3009,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
}
}
if (scroll)
properties.scrollTo(getAdapterPosition(), 0);

@ -354,6 +354,18 @@ public class EntityMessage implements Serializable {
EntityMessage.SMIME_SIGNENCRYPT.equals(ui_encrypt));
}
boolean isVerifiable(){
return (EntityMessage.PGP_SIGNONLY.equals(encrypt) ||
EntityMessage.SMIME_SIGNONLY.equals(encrypt));
}
boolean isUnlocked() {
return (EntityMessage.PGP_SIGNENCRYPT.equals(ui_encrypt) &&
!EntityMessage.PGP_SIGNENCRYPT.equals(encrypt)) ||
(EntityMessage.SMIME_SIGNENCRYPT.equals(ui_encrypt) &&
!EntityMessage.SMIME_SIGNENCRYPT.equals(encrypt));
}
String[] checkFromDomain(Context context) {
return MessageHelper.equalRootDomain(context, from, smtp_from);
}

Loading…
Cancel
Save