Fixed message text sometimes obscured

This commit is contained in:
M66B 2018-11-16 19:30:10 +01:00
parent 203fcc1eba
commit ed513ddb68
2 changed files with 30 additions and 51 deletions

1
FAQ.md
View File

@ -34,7 +34,6 @@ Anything on this list is in random order and *might* be added in the near future
## Known problems ## Known problems
* Large replied/forwarded texts resulting in [ANR](https://developer.android.com/topic/performance/vitals/anr)s * 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) * File not selected (canceled) when using a file manager instead of the [Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider)

View File

@ -236,6 +236,9 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
grpExpanded = itemView.findViewById(R.id.grpExpanded); grpExpanded = itemView.findViewById(R.id.grpExpanded);
tvBody.setMovementMethod(new UrlHandler()); tvBody.setMovementMethod(new UrlHandler());
if (viewType == ViewType.THREAD)
itemView.setHasTransientState(true);
} }
private void wire() { private void wire() {
@ -448,47 +451,42 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
} }
if (!EntityFolder.OUTBOX.equals(message.folderType)) { if (!EntityFolder.OUTBOX.equals(message.folderType)) {
bnvActions.setHasTransientState(true);
db.folder().liveSystemFolders(message.account).observe(owner, new Observer<List<EntityFolder>>() { db.folder().liveSystemFolders(message.account).observe(owner, new Observer<List<EntityFolder>>() {
@Override @Override
public void onChanged(@Nullable List<EntityFolder> folders) { public void onChanged(@Nullable List<EntityFolder> folders) {
if (bnvActions.hasTransientState()) { boolean hasJunk = false;
boolean hasJunk = false; boolean hasTrash = false;
boolean hasTrash = false; boolean hasArchive = false;
boolean hasArchive = false;
if (folders != null) if (folders != null)
for (EntityFolder folder : folders) { for (EntityFolder folder : folders) {
if (EntityFolder.JUNK.equals(folder.type)) if (EntityFolder.JUNK.equals(folder.type))
hasJunk = true; hasJunk = true;
else if (EntityFolder.TRASH.equals(folder.type)) else if (EntityFolder.TRASH.equals(folder.type))
hasTrash = true; hasTrash = true;
else if (EntityFolder.ARCHIVE.equals(folder.type)) else if (EntityFolder.ARCHIVE.equals(folder.type))
hasArchive = true; hasArchive = true;
} }
boolean inOutbox = EntityFolder.OUTBOX.equals(message.folderType); boolean inOutbox = EntityFolder.OUTBOX.equals(message.folderType);
boolean inArchive = EntityFolder.ARCHIVE.equals(message.folderType); boolean inArchive = EntityFolder.ARCHIVE.equals(message.folderType);
boolean inTrash = EntityFolder.TRASH.equals(message.folderType); boolean inTrash = EntityFolder.TRASH.equals(message.folderType);
ActionData data = new ActionData(); ActionData data = new ActionData();
data.hasJunk = hasJunk; data.hasJunk = hasJunk;
data.delete = (inTrash || !hasTrash || inOutbox); data.delete = (inTrash || !hasTrash || inOutbox);
data.message = message; data.message = message;
bnvActions.setTag(data); bnvActions.setTag(data);
bnvActions.getMenu().findItem(R.id.action_delete).setVisible((message.uid != null && hasTrash) || (inOutbox && !TextUtils.isEmpty(message.error))); 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_move).setVisible(message.uid != null);
bnvActions.getMenu().findItem(R.id.action_archive).setVisible(message.uid != null && !inArchive && hasArchive); bnvActions.getMenu().findItem(R.id.action_archive).setVisible(message.uid != null && !inArchive && hasArchive);
bnvActions.getMenu().findItem(R.id.action_reply).setEnabled(message.content); 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_reply).setVisible(!inOutbox);
bnvActions.setVisibility(View.VISIBLE); bnvActions.setVisibility(View.VISIBLE);
vSeparatorBody.setVisibility(View.GONE); vSeparatorBody.setVisibility(View.GONE);
bnvActions.setHasTransientState(false);
}
} }
}); });
} }
@ -670,14 +668,6 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
private SimpleTask<Spanned> bodyTask = new SimpleTask<Spanned>() { private SimpleTask<Spanned> bodyTask = new SimpleTask<Spanned>() {
private String body = null; private String body = null;
@Override
protected void onInit(Bundle args) {
btnHtml.setHasTransientState(true);
btnImages.setHasTransientState(true);
tvBody.setHasTransientState(true);
pbBody.setHasTransientState(true);
}
@Override @Override
protected Spanned onLoad(final Context context, final Bundle args) throws Throwable { protected Spanned onLoad(final Context context, final Bundle args) throws Throwable {
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
@ -699,20 +689,10 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
btnImages.setVisibility(has_images && show_expanded && !show_images ? View.VISIBLE : View.GONE); btnImages.setVisibility(has_images && show_expanded && !show_images ? View.VISIBLE : View.GONE);
tvBody.setText(body); tvBody.setText(body);
pbBody.setVisibility(View.GONE); pbBody.setVisibility(View.GONE);
btnHtml.setHasTransientState(false);
btnImages.setHasTransientState(false);
tvBody.setHasTransientState(false);
pbBody.setHasTransientState(false);
} }
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
btnHtml.setHasTransientState(false);
btnImages.setHasTransientState(false);
tvBody.setHasTransientState(false);
pbBody.setHasTransientState(false);
Helper.unexpectedError(context, ex); Helper.unexpectedError(context, ex);
} }
}; };