Loading app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +9 −7 Original line number Diff line number Diff line Loading @@ -1152,15 +1152,17 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class); statusesVM.getAttachment(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, attachment.id) .observe((LifecycleOwner) context, attachmentReceived -> { if(attachmentReceived != null) { List<Attachment> attachments = statusList.get(position).media_attachments; for(Attachment attach : attachments) { if(attach.id.equals(attachment.id)) { if(attach.id != null && attach.id.equals(attachment.id)) { statusList.get(position).media_attachments.remove(attachment); break; } } statusList.get(position).media_attachments.add(attachmentReceived); notifyItemChanged(position); } }); } ComposeAttachmentItemBinding composeAttachmentItemBinding = ComposeAttachmentItemBinding.inflate(LayoutInflater.from(context), holder.binding.attachmentsList, false); Loading app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusDraftAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -135,9 +135,9 @@ public class StatusDraftAdapter extends RecyclerView.Adapter<StatusDraftAdapter. } } //If there are media, we need to remove them first. if (attachments.size() > 0) { if (!attachments.isEmpty()) { for (Attachment attachment : attachments) { if (attachment.local_path != null) { if (attachment != null && attachment.local_path != null) { File fileToDelete = new File(attachment.local_path); if (fileToDelete.exists()) { //noinspection ResultOfMethodCallIgnored Loading Loading
app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +9 −7 Original line number Diff line number Diff line Loading @@ -1152,15 +1152,17 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class); statusesVM.getAttachment(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, attachment.id) .observe((LifecycleOwner) context, attachmentReceived -> { if(attachmentReceived != null) { List<Attachment> attachments = statusList.get(position).media_attachments; for(Attachment attach : attachments) { if(attach.id.equals(attachment.id)) { if(attach.id != null && attach.id.equals(attachment.id)) { statusList.get(position).media_attachments.remove(attachment); break; } } statusList.get(position).media_attachments.add(attachmentReceived); notifyItemChanged(position); } }); } ComposeAttachmentItemBinding composeAttachmentItemBinding = ComposeAttachmentItemBinding.inflate(LayoutInflater.from(context), holder.binding.attachmentsList, false); Loading
app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusDraftAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -135,9 +135,9 @@ public class StatusDraftAdapter extends RecyclerView.Adapter<StatusDraftAdapter. } } //If there are media, we need to remove them first. if (attachments.size() > 0) { if (!attachments.isEmpty()) { for (Attachment attachment : attachments) { if (attachment.local_path != null) { if (attachment != null && attachment.local_path != null) { File fileToDelete = new File(attachment.local_path); if (fileToDelete.exists()) { //noinspection ResultOfMethodCallIgnored Loading