From ed513ddb68a15cd2cdd9b42716077b503c103610 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 16 Nov 2018 19:30:10 +0100 Subject: [PATCH] Fixed message text sometimes obscured --- FAQ.md | 1 - .../eu/faircode/email/AdapterMessage.java | 82 +++++++------------ 2 files changed, 31 insertions(+), 52 deletions(-) diff --git a/FAQ.md b/FAQ.md index 8adb8408a1..6a75347453 100644 --- a/FAQ.md +++ b/FAQ.md @@ -34,7 +34,6 @@ Anything on this list is in random order and *might* be added in the near future ## Known problems * Large replied/forwarded texts resulting in [ANR](https://developer.android.com/topic/performance/vitals/anr)s -* Message text sometimes hidden under *Show original* * File not selected (canceled) when using a file manager instead of the [Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 9fcc89f42c..d420a9852c 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -236,6 +236,9 @@ public class AdapterMessage extends PagedListAdapter>() { @Override public void onChanged(@Nullable List folders) { - if (bnvActions.hasTransientState()) { - boolean hasJunk = false; - boolean hasTrash = false; - boolean hasArchive = false; - - if (folders != null) - for (EntityFolder folder : folders) { - if (EntityFolder.JUNK.equals(folder.type)) - hasJunk = true; - else if (EntityFolder.TRASH.equals(folder.type)) - hasTrash = true; - else if (EntityFolder.ARCHIVE.equals(folder.type)) - hasArchive = true; - } - - boolean inOutbox = EntityFolder.OUTBOX.equals(message.folderType); - boolean inArchive = EntityFolder.ARCHIVE.equals(message.folderType); - boolean inTrash = EntityFolder.TRASH.equals(message.folderType); + boolean hasJunk = false; + boolean hasTrash = false; + boolean hasArchive = false; + + if (folders != null) + for (EntityFolder folder : folders) { + if (EntityFolder.JUNK.equals(folder.type)) + hasJunk = true; + else if (EntityFolder.TRASH.equals(folder.type)) + hasTrash = true; + else if (EntityFolder.ARCHIVE.equals(folder.type)) + hasArchive = true; + } - ActionData data = new ActionData(); - data.hasJunk = hasJunk; - data.delete = (inTrash || !hasTrash || inOutbox); - data.message = message; - bnvActions.setTag(data); + boolean inOutbox = EntityFolder.OUTBOX.equals(message.folderType); + boolean inArchive = EntityFolder.ARCHIVE.equals(message.folderType); + boolean inTrash = EntityFolder.TRASH.equals(message.folderType); - bnvActions.getMenu().findItem(R.id.action_delete).setVisible((message.uid != null && hasTrash) || (inOutbox && !TextUtils.isEmpty(message.error))); - bnvActions.getMenu().findItem(R.id.action_move).setVisible(message.uid != null); - bnvActions.getMenu().findItem(R.id.action_archive).setVisible(message.uid != null && !inArchive && hasArchive); + ActionData data = new ActionData(); + data.hasJunk = hasJunk; + data.delete = (inTrash || !hasTrash || inOutbox); + data.message = message; + bnvActions.setTag(data); - bnvActions.getMenu().findItem(R.id.action_reply).setEnabled(message.content); - bnvActions.getMenu().findItem(R.id.action_reply).setVisible(!inOutbox); + bnvActions.getMenu().findItem(R.id.action_delete).setVisible((message.uid != null && hasTrash) || (inOutbox && !TextUtils.isEmpty(message.error))); + bnvActions.getMenu().findItem(R.id.action_move).setVisible(message.uid != null); + bnvActions.getMenu().findItem(R.id.action_archive).setVisible(message.uid != null && !inArchive && hasArchive); - bnvActions.setVisibility(View.VISIBLE); - vSeparatorBody.setVisibility(View.GONE); + bnvActions.getMenu().findItem(R.id.action_reply).setEnabled(message.content); + bnvActions.getMenu().findItem(R.id.action_reply).setVisible(!inOutbox); - bnvActions.setHasTransientState(false); - } + bnvActions.setVisibility(View.VISIBLE); + vSeparatorBody.setVisibility(View.GONE); } }); } @@ -670,14 +668,6 @@ public class AdapterMessage extends PagedListAdapter bodyTask = new SimpleTask() { private String body = null; - @Override - protected void onInit(Bundle args) { - btnHtml.setHasTransientState(true); - btnImages.setHasTransientState(true); - tvBody.setHasTransientState(true); - pbBody.setHasTransientState(true); - } - @Override protected Spanned onLoad(final Context context, final Bundle args) throws Throwable { TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); @@ -699,20 +689,10 @@ public class AdapterMessage extends PagedListAdapter