Fixed occasional wrong message text

This commit is contained in:
M66B 2019-02-06 18:40:12 +00:00
parent b220aec166
commit dcea0ce4a9
1 changed files with 9 additions and 10 deletions

View File

@ -1470,8 +1470,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
private SimpleTask<SpannableStringBuilder> bodyTask = new SimpleTask<SpannableStringBuilder>() { private SimpleTask<SpannableStringBuilder> bodyTask = new SimpleTask<SpannableStringBuilder>() {
private String body = null;
@Override @Override
protected void onPreExecute(Bundle args) { protected void onPreExecute(Bundle args) {
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
@ -1484,14 +1482,15 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected SpannableStringBuilder onExecute(Context context, final Bundle args) { protected SpannableStringBuilder onExecute(Context context, final Bundle args) {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
if (body == null)
try { String body;
body = Helper.readText(EntityMessage.getFile(context, message.id)); try {
} catch (IOException ex) { body = Helper.readText(EntityMessage.getFile(context, message.id));
Log.e(ex); } catch (IOException ex) {
body = ""; Log.e(ex);
db.message().setMessageContent(message.id, false, null); db.message().setMessageContent(message.id, false, null);
} return null;
}
Spanned html = decodeHtml(context, message, body); Spanned html = decodeHtml(context, message, body);