mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 09:47:13 +00:00
Refactoring
This commit is contained in:
parent
b39a7e852d
commit
a5de71cb6a
1 changed files with 18 additions and 19 deletions
|
@ -1536,7 +1536,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
@Override
|
@Override
|
||||||
protected void onExecuted(Bundle args, Object result) {
|
protected void onExecuted(Bundle args, Object result) {
|
||||||
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
|
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
|
||||||
properties.setValue("inline_encrypted", message.id, args.getBoolean("inline_encrypted"));
|
|
||||||
|
|
||||||
TupleMessageEx amessage = getMessage();
|
TupleMessageEx amessage = getMessage();
|
||||||
if (amessage == null || !amessage.id.equals(message.id))
|
if (amessage == null || !amessage.id.equals(message.id))
|
||||||
|
@ -1566,8 +1565,22 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
|
|
||||||
pbBody.setVisibility(View.GONE);
|
pbBody.setVisibility(View.GONE);
|
||||||
|
|
||||||
// Show attachments/images
|
// Show attachments
|
||||||
cowner.start();
|
cowner.start();
|
||||||
|
|
||||||
|
// Show encrypt actions
|
||||||
|
ibVerify.setVisibility(EntityMessage.PGP_SIGNONLY.equals(message.encrypt)
|
||||||
|
? View.VISIBLE : View.GONE);
|
||||||
|
ibDecrypt.setVisibility(args.getBoolean("inline_encrypted") ||
|
||||||
|
EntityMessage.PGP_SIGNENCRYPT.equals(message.encrypt)
|
||||||
|
? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
boolean auto_decrypt = prefs.getBoolean("auto_decrypt", false);
|
||||||
|
if (auto_decrypt && EntityMessage.PGP_SIGNENCRYPT.equals(message.encrypt))
|
||||||
|
onActionDecrypt(message, true);
|
||||||
|
|
||||||
|
// Show images
|
||||||
ibImages.setVisibility(has_images ? View.VISIBLE : View.GONE);
|
ibImages.setVisibility(has_images ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1586,12 +1599,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
grpAttachments.setVisibility(attachments.size() > 0 ? View.VISIBLE : View.GONE);
|
grpAttachments.setVisibility(attachments.size() > 0 ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
boolean show_inline = properties.getValue("inline", message.id);
|
boolean show_inline = properties.getValue("inline", message.id);
|
||||||
boolean inline_encrypted = properties.getValue("inline_encrypted", message.id);
|
Log.i("Show inline=" + show_inline);
|
||||||
Log.i("Show inline=" + show_inline + " encrypted=" + inline_encrypted);
|
|
||||||
|
|
||||||
boolean has_inline = false;
|
boolean has_inline = false;
|
||||||
boolean is_signed = false;
|
|
||||||
boolean is_encrypted = false;
|
|
||||||
boolean download = false;
|
boolean download = false;
|
||||||
boolean save = (attachments.size() > 1);
|
boolean save = (attachments.size() > 1);
|
||||||
boolean downloading = false;
|
boolean downloading = false;
|
||||||
|
@ -1602,10 +1612,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
boolean inline = (attachment.isInline() && attachment.isImage());
|
boolean inline = (attachment.isInline() && attachment.isImage());
|
||||||
if (inline)
|
if (inline)
|
||||||
has_inline = true;
|
has_inline = true;
|
||||||
if (Objects.equals(attachment.encryption, EntityAttachment.PGP_MESSAGE))
|
|
||||||
is_encrypted = true;
|
|
||||||
if (Objects.equals(attachment.encryption, EntityAttachment.PGP_SIGNATURE))
|
|
||||||
is_signed = true;
|
|
||||||
if (attachment.progress == null && !attachment.available)
|
if (attachment.progress == null && !attachment.available)
|
||||||
download = true;
|
download = true;
|
||||||
if (!attachment.available)
|
if (!attachment.available)
|
||||||
|
@ -1641,14 +1647,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
btnDownloadAttachments.setVisibility(download && suitable ? View.VISIBLE : View.GONE);
|
btnDownloadAttachments.setVisibility(download && suitable ? View.VISIBLE : View.GONE);
|
||||||
tvNoInternetAttachments.setVisibility(downloading && !suitable ? View.VISIBLE : View.GONE);
|
tvNoInternetAttachments.setVisibility(downloading && !suitable ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
ibVerify.setVisibility(is_signed ? View.VISIBLE : View.GONE);
|
|
||||||
ibDecrypt.setVisibility(inline_encrypted || is_encrypted ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
boolean auto_decrypt = prefs.getBoolean("auto_decrypt", false);
|
|
||||||
if (auto_decrypt && is_encrypted)
|
|
||||||
onActionDecrypt(message, true);
|
|
||||||
|
|
||||||
cbInline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
cbInline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
@ -2702,7 +2700,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
lbm.sendBroadcast(
|
lbm.sendBroadcast(
|
||||||
new Intent(FragmentMessages.ACTION_DECRYPT)
|
new Intent(FragmentMessages.ACTION_DECRYPT)
|
||||||
.putExtra("id", message.id)
|
.putExtra("id", message.id)
|
||||||
.putExtra("auto", auto));
|
.putExtra("auto", auto)
|
||||||
|
.putExtra("type", (int) message.encrypt));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onActionReplyMenu(TupleMessageEx message) {
|
private void onActionReplyMenu(TupleMessageEx message) {
|
||||||
|
|
Loading…
Reference in a new issue