Simplification

master
M66B 2 months ago
parent 01ee0f2f8c
commit e95dfd931a

@ -3923,13 +3923,6 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onExecuted(Bundle args, final Spanned body) { protected void onExecuted(Bundle args, final Spanned body) {
// Show attachments
boolean hide_attachments = Boolean.TRUE.equals(ibExpanderAttachments.getTag());
if (hide_attachments) {
ibExpanderAttachments.setTag(null);
ownerAttachment.restart();
}
// Update text // Update text
if (body != null) if (body != null)
etBody.setText(body); etBody.setText(body);
@ -3980,13 +3973,6 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onExecuted(Bundle args, ArrayList<UriType> images) { protected void onExecuted(Bundle args, ArrayList<UriType> images) {
// Show attachments
boolean hide_attachments = Boolean.TRUE.equals(ibExpanderAttachments.getTag());
if (hide_attachments) {
ibExpanderAttachments.setTag(null);
ownerAttachment.restart();
}
if (images.size() == 0) if (images.size() == 0)
return; return;
@ -6729,11 +6715,17 @@ public class FragmentCompose extends FragmentBase {
db.attachment().liveAttachments(data.draft.id).observe(ownerAttachment, db.attachment().liveAttachments(data.draft.id).observe(ownerAttachment,
new Observer<List<EntityAttachment>>() { new Observer<List<EntityAttachment>>() {
private Integer lastAttachments = null;
@Override @Override
public void onChanged(@Nullable List<EntityAttachment> attachments) { public void onChanged(@Nullable List<EntityAttachment> attachments) {
if (attachments == null) if (attachments == null)
attachments = new ArrayList<>(); attachments = new ArrayList<>();
if (lastAttachments != null && attachments.size() > lastAttachments)
ibExpanderAttachments.setTag(false);
lastAttachments = attachments.size();
boolean hide_attachments = Boolean.TRUE.equals(ibExpanderAttachments.getTag()); boolean hide_attachments = Boolean.TRUE.equals(ibExpanderAttachments.getTag());
List<EntityAttachment> a = (hide_attachments ? new ArrayList<>() : new ArrayList<>(attachments)); List<EntityAttachment> a = (hide_attachments ? new ArrayList<>() : new ArrayList<>(attachments));

Loading…
Cancel
Save