Fixed occasional wrong message text

pull/147/head
M66B 6 years ago
parent b220aec166
commit dcea0ce4a9

@ -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);

Loading…
Cancel
Save