Revert "Consider images without name as inline"

This reverts commit f88879f8df.
pull/169/head
M66B 5 years ago
parent 5c87d2464e
commit 006533b15e

@ -106,7 +106,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
} }
private void bindTo(EntityAttachment attachment) { private void bindTo(EntityAttachment attachment) {
view.setAlpha(attachment.isInlineImage() ? Helper.LOW_LIGHT : 1.0f); view.setAlpha(attachment.isInline() && attachment.isImage() ? Helper.LOW_LIGHT : 1.0f);
ibDelete.setVisibility(readonly ? View.GONE : attachment.isInline() ? View.INVISIBLE : View.VISIBLE); ibDelete.setVisibility(readonly ? View.GONE : attachment.isInline() ? View.INVISIBLE : View.VISIBLE);
tvName.setText(attachment.name); tvName.setText(attachment.name);

@ -1285,7 +1285,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int inlineImages = 0; int inlineImages = 0;
if (attachments != null) if (attachments != null)
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (attachment.available && attachment.isInlineImage()) if (attachment.available && attachment.isInline() && attachment.isImage())
inlineImages++; inlineImages++;
if (inlineImages != lastInlineImages) { if (inlineImages != lastInlineImages) {
@ -1647,7 +1647,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
List<EntityAttachment> a = new ArrayList<>(); List<EntityAttachment> a = new ArrayList<>();
for (EntityAttachment attachment : attachments) { for (EntityAttachment attachment : attachments) {
boolean inline = ((attachment.isInlineImage()) || attachment.encryption != null); boolean inline = ((attachment.isInline() && attachment.isImage()) || attachment.encryption != null);
if (inline) if (inline)
has_inline = true; has_inline = true;
if (attachment.progress == null && !attachment.available) if (attachment.progress == null && !attachment.available)
@ -1701,7 +1701,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
List<EntityAttachment> images = new ArrayList<>(); List<EntityAttachment> images = new ArrayList<>();
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (!attachment.isInlineImage()) if (!attachment.isInline() && attachment.isImage())
images.add(attachment); images.add(attachment);
adapterImage.set(images); adapterImage.set(images);
grpImages.setVisibility(images.size() > 0 ? View.VISIBLE : View.GONE); grpImages.setVisibility(images.size() > 0 ? View.VISIBLE : View.GONE);
@ -2715,7 +2715,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id); List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (attachment.isInlineImage() && if (attachment.isInline() && attachment.isImage() &&
attachment.progress == null && !attachment.available) attachment.progress == null && !attachment.available)
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id); EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id);

@ -109,10 +109,6 @@ public class EntityAttachment {
return IMAGE_TYPES.contains(type); return IMAGE_TYPES.contains(type);
} }
boolean isInlineImage() {
return ((isInline() || TextUtils.isEmpty(name)) && isImage());
}
File getFile(Context context) { File getFile(Context context) {
return getFile(context, id, name); return getFile(context, id, name);
} }

@ -2978,7 +2978,8 @@ public class FragmentCompose extends FragmentBase {
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (attachment.encryption == null && if (attachment.encryption == null &&
("forward".equals(action) || "editasnew".equals(action) || ("forward".equals(action) || "editasnew".equals(action) ||
(cid.contains(attachment.cid) || attachment.isInlineImage()))) { (cid.contains(attachment.cid) ||
(attachment.isInline() && attachment.isImage())))) {
if (attachment.available) { if (attachment.available) {
File source = attachment.getFile(context); File source = attachment.getFile(context);
@ -3130,7 +3131,7 @@ public class FragmentCompose extends FragmentBase {
available++; available++;
if (attachment.progress != null) if (attachment.progress != null)
downloading = true; downloading = true;
if (attachment.isInlineImage()) if (attachment.isInline() && attachment.isImage())
inline_images = true; inline_images = true;
} }

Loading…
Cancel
Save