Small optimization

pull/147/head
M66B 7 years ago
parent 4e087c18b3
commit 287ddefa9f

@ -331,7 +331,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
vwColor.getTop(), vwColor.getTop(),
itemView.getRight(), itemView.getRight(),
vwColor.getBottom()); vwColor.getBottom());
Log.i("Touch delegate=" + rect);
itemView.setTouchDelegate(new TouchDelegate(rect, touch)); itemView.setTouchDelegate(new TouchDelegate(rect, touch));
} }
}); });
@ -1268,18 +1267,22 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
builder.removeSpan(quoteSpan); builder.removeSpan(quoteSpan);
} }
args.putBoolean("has_quotes", builder.getSpans(0, body.length(), StyledQuoteSpan.class).length > 0);
args.putBoolean("has_images", builder.getSpans(0, body.length(), ImageSpan.class).length > 0);
return builder; return builder;
} }
@Override @Override
protected void onExecuted(Bundle args, SpannableStringBuilder body) { protected void onExecuted(Bundle args, SpannableStringBuilder body) {
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
properties.setBody(message.id, body);
if (args.getInt("position") != position) if (args.getInt("position") != position)
return; return;
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); boolean has_quotes = args.getBoolean("has_quotes");
boolean has_images = args.getBoolean("has_images");
boolean has_quotes = (body.getSpans(0, body.length(), StyledQuoteSpan.class).length > 0);
boolean has_images = (body.getSpans(0, body.length(), ImageSpan.class).length > 0);
boolean show_expanded = properties.getValue("expanded", message.id); boolean show_expanded = properties.getValue("expanded", message.id);
boolean show_quotes = properties.getValue("quotes", message.id); boolean show_quotes = properties.getValue("quotes", message.id);
boolean show_images = properties.getValue("images", message.id); boolean show_images = properties.getValue("images", message.id);
@ -1290,8 +1293,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvBody.setText(body); tvBody.setText(body);
tvBody.setMovementMethod(new UrlHandler()); tvBody.setMovementMethod(new UrlHandler());
pbBody.setVisibility(View.GONE); pbBody.setVisibility(View.GONE);
properties.setBody(message.id, body);
} }
@Override @Override

Loading…
Cancel
Save